DDKitSwift
is the supporting framework of DDKitSwift
plug-ins, the object-oriented is the development of DDKitSwift
plug-in. It provides plug-in display, management and other functions. You can quickly develop and display DDKitSwift plug-ins by implementing the DDKitSwiftPluginProtocol
. This document provides plug-in development tutorials and use tutorials, which developers can view as needed.
Project import DDKitSwift
, you can use cocoapods to quickly import core files
pod 'DDKitSwift'
Declare an object and follow the DDKitSwiftPluginProtocol
protocol.
class PluginDemo: NSObject {
var isPluginRunning = true
}
extension PluginDemo: DDKitSwiftPluginProtocol {
//Unique identification
var pluginIdentifier: String {
return "com.DDKitSwift.pluginDemo"
}
var pluginIcon: UIImage? {
return UIImage(named: "DDKitSwift")
}
var pluginTitle: String {
return "title"
}
var pluginType: DDKitSwiftPluginType {
return .ui
}
func start() {
print("start plugin")
isPluginRunning = true
}
var isRunning: Bool {
return isPluginRunning
}
func stop() {
print("plugin stop running")
isPluginRunning = false
}
}
func willStart()
func willStop()
After that, you can register the plug-in, you only need to register once globally
DDKitSwift.regist(plugin: PluginDemo())
After cocoapods is released and online, when the user opens DDKitSwift
, your plug-in will appear on the debug collection page
DDKitSwift.UIConfig
DDKitSwift.DebugFolderPath
DDKitSwift.show(.input(placeholder: "placeholder", text: nil, endEdit: { text in
print(text)
}))
let config = DDKitSwiftButtonConfig(title: "test\(i)")
DDKitSwift.updateFloatButton(config: config, plugin: PluginDemo())
printError("error")
DDKitSwift
provides the following message notifications, you can get the frame display, hide, close, and register new plug-in timing by binding the following notifications
//new plug-in regist
NSNotification.Name.DDKitSwiftPluginRegist
//show
NSNotification.Name.DDKitSwiftShow
//hide
NSNotification.Name.DDKitSwiftHide
//close
NSNotification.Name.DDKitSwiftClose
The DDKitSwift plug-in is easy to use. For example, install the log plugin DDKitSwiftLogger
.
pod 'DDKitSwiftLogger/DDKitSwift'
DDKitSwift.regist(plugin: DDKitSwiftLogger.shared)
DDKitSwift.show()
DDKitSwift.hide()
DDKitSwift.close()
We have released a cocoaPods library named DDKitSwift, which is a tool library that integrates multiple DDKitSwift-plugins。It can help you quickly use multiple debugging functions
DDKitSwift is released under the MIT license.