XWSwiftLoader

作者: __Mr_Xie__ | 来源:发表于2022-01-04 13:03 被阅读0次

    XWSwiftLoader

    XWSwiftLoader 库的目的:Swift环境中+ (void)load;+ (void)initialize;的实现;

    Installation

    XWSwiftLoader is available through CocoaPods. To install
    it, simply add the following line to your Podfile:

    pod 'XWSwiftLoader'
    

    使用步骤

    step 1:new a xxx.m file in your project

    You can new a .m file anywhere of your project ,and reference in your project.

    step 2:write micros make your class enable load() and initialize() function

    wtire the code Like this in the xxx.m file

    #import <Foundation/Foundation.h>
    #import <XWSwiftLoader_Example-Swift.h>
    
    XW_SWIFT_LOADER(ViewController)
    

    step 3:implementation of load() and initialize() method callback

    import UIKit
    import XWSwiftLoader
    
    @objc class ViewController: UIViewController {
    
        override func viewDidLoad() {
            super.viewDidLoad()
            // Do any additional setup after loading the view, typically from a nib.
        }
    
        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }
    
    }
    
    extension ViewController: XWSwiftLoaderProtocol {
        
        static func xw_Load() {
            print("xw_Load")
        }
        
        static func xw_Initialize() {
            print("xw_Initialize")
        }
        
    }
    

    注⚠️:具体可以参照demo中示例

    Author

    简书号:Mr_Xie,如果你有什么建议,可以关注我的简书,直接留言,留言必回。

    License

    XWSwiftLoader is available under the MIT license. See the LICENSE file for more info.

    相关文章

      网友评论

        本文标题:XWSwiftLoader

        本文链接:https://www.haomeiwen.com/subject/bnuqcrtx.html