iOS 框架 - 将 plist 放入字典

iOS Framework - get plist into a dictionary

我正在创建一个 iOS - 框架 (swift) 我有这个功能 - 我正在使用它来检索应该包含所有 lib 属性(字符串)

的字典
func getPropertyList() -> [String: Any]?{
    let path = Bundle.main.path(forResource: "properties", ofType: "plist")!
    let dict = NSDictionary(contentsOfFile: path) as? [String: Any]
    return dict
}

从测试这一行开始一直返回 nil

Bundle.main.path(forResource: "properties", ofType: "plist")!

即使 properties.plist 文件位于 'copy Bundle Resources' 并选择了目标会员

使用

let path = Bundle(identifier:"com.example.frameworkID")!.path(forResource: "properties", ofType: "plist")!