-
目录
ios swift 创建framework(一):https://www.jianshu.com/p/2acd1fbb7537
ios swift 创建framework(二)资源图片image引用:https://www.jianshu.com/p/deeefdc7714f
1.效果如图

实现方式
2.创建sdk项目 Xcode -> File -> New Project -> Framework

3.创建对外的文件 LZSDKManager.swift 并实现SDK的内部逻辑

//
// LZSDKManager.swift
// LZSDK
//
// Created by LiZhi on 2022/4/23.
//
import Foundation
open class LZSDKManager {
public init(){
}
public func sdk_print() {
print("荔枝 sdk print 2")
}
}
4.Target 创建LZSDKDemo


5.重要 在LZSDKDemo General 中添加 LZSDK.framework,


6.LZSDKDemo中代码调用 import LZSDK

import UIKit
import LZSDK
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
let manager = LZSDKManager()
manager.sdk_print()
}
}
7.成功了,点赞

8.代码地址:https://github.com/lizhi0123/LZSwiftDemos/tree/main/LZSDK
网友评论