{"id":1713,"url":"https://github.com/tristanhimmelman/ObjectMapper","last_synced_at":"2025-08-06T13:32:17.687Z","repository":{"id":21985582,"uuid":"25310522","full_name":"tristanhimmelman/ObjectMapper","owner":"tristanhimmelman","description":"Simple JSON Object mapping written in Swift","archived":false,"fork":false,"pushed_at":"2024-05-02T13:32:48.000Z","size":1332,"stargazers_count":9155,"open_issues_count":68,"forks_count":1035,"subscribers_count":215,"default_branch":"master","last_synced_at":"2024-10-29T16:40:56.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tristanhimmelman.png","metadata":{"files":{"readme":"README-CN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-16T16:14:49.000Z","updated_at":"2024-10-29T00:38:57.000Z","dependencies_parsed_at":"2024-04-27T20:40:22.323Z","dependency_job_id":"06d8e272-1c2b-4f38-8dd5-5516c25a5145","html_url":"https://github.com/tristanhimmelman/ObjectMapper","commit_stats":{"total_commits":782,"total_committers":144,"mean_commits":5.430555555555555,"dds":0.5063938618925832,"last_synced_commit":"6021c6035e83a306047348666f6400dc61445d3b"},"previous_names":["hearst-dd/objectmapper"],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanhimmelman%2FObjectMapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanhimmelman%2FObjectMapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanhimmelman%2FObjectMapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanhimmelman%2FObjectMapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tristanhimmelman","download_url":"https://codeload.github.com/tristanhimmelman/ObjectMapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228383694,"owners_count":17911329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:54.039Z","updated_at":"2024-12-09T14:30:48.131Z","avatar_url":"https://github.com/tristanhimmelman.png","language":"Swift","funding_links":[],"categories":["Parsing","Libs","Swift","\u003ca name=\"for-projects\"\u003e\u003c/a\u003e For Projects","Data and Storage","Data Management [🔝](#readme)","iOS","JSON"],"sub_categories":["JSON","Data Management","\u003ca name=\"for-projects-example-projects\"\u003e\u003c/a\u003e Example Projects"],"readme":"# ObjectMapper-CN-Guide\n\u003e 文档由Swift老司机活动中心负责翻译，欢迎关注[@SwiftOldDriver](http://weibo.com/6062089411)。翻译有问题可以到 [ObjectMapper-CN-Guide](https://github.com/SwiftOldDriver/ObjectMapper-CN-Guide) 提 PR。\n\n[ObjectMapper](https://github.com/Hearst-DD/ObjectMapper) 是一个使用 Swift 编写的用于 model 对象（类和结构体）和 JSON  之间转换的框架。\n\n- [特性](#特性)\n- [基础使用方法](#基础使用方法)\n- [映射嵌套对象](#映射嵌套对象)\n- [自定义转换规则](#自定义转换规则)\n- [继承](#继承)\n- [泛型对象](#泛型对象)\n- [映射时的上下文对象](#映射时的上下文对象)\n- [ObjectMapper + Alamofire](#objectmapper--alamofire) \n- [ObjectMapper + Realm](#objectmapper--realm)\n- [待完成](#待完成)\n- [安装](#安装)\n\n# 特性:\n- 把 JSON 映射成对象 \n- 把对象映射 JSON\n- 支持嵌套对象 (单独的成员变量、在数组或字典中都可以)\n- 在转换过程支持自定义规则\n- 支持结构体（ Struct ）\n- [Immutable support](#immutablemappable-protocol-beta) (目前还在 beta )\n\n# 基础使用方法\n为了支持映射，类或者结构体只需要实现```Mappable```协议。这个协议包含以下方法：\n```swift\ninit?(map: Map)\nmutating func mapping(map: Map)\n```\nObjectMapper使用自定义的```\u003c-``` 运算符来声明成员变量和 JSON 的映射关系。\n```swift\nclass User: Mappable {\n    var username: String?\n    var age: Int?\n    var weight: Double!\n    var array: [AnyObject]?\n    var dictionary: [String : AnyObject] = [:]\n    var bestFriend: User?                       // 嵌套的 User 对象\n    var friends: [User]?                        // Users 的数组\n    var birthday: NSDate?\n\n    required init?(map: Map) {\n\n    }\n\n    // Mappable\n    func mapping(map: Map) {\n        username    \u003c- map[\"username\"]\n        age         \u003c- map[\"age\"]\n        weight      \u003c- map[\"weight\"]\n        array       \u003c- map[\"arr\"]\n        dictionary  \u003c- map[\"dict\"]\n        bestFriend  \u003c- map[\"best_friend\"]\n        friends     \u003c- map[\"friends\"]\n        birthday    \u003c- (map[\"birthday\"], DateTransform())\n    }\n}\n\nstruct Temperature: Mappable {\n    var celsius: Double?\n    var fahrenheit: Double?\n\n    init?(map: Map) {\n\n    }\n\n    mutating func mapping(map: Map) {\n        celsius \t\u003c- map[\"celsius\"]\n        fahrenheit \t\u003c- map[\"fahrenheit\"]\n    }\n}\n```\n\n一旦你的对象实现了 `Mappable`, ObjectMapper就可以让你轻松的实现和 JSON 之间的转换。\n\n把 JSON 字符串转成 model 对象：\n\n```swift\nlet user = User(JSONString: JSONString)\n```\n\n把一个 model 转成 JSON 字符串：\n\n```swift\nlet JSONString = user.toJSONString(prettyPrint: true)\n```\n\n也可以使用`Mapper.swift`类来完成转换（这个类还额外提供了一些函数来处理一些特殊的情况：\n\n```swift\n// 把 JSON 字符串转成 Model\nlet user = Mapper\u003cUser\u003e().map(JSONString: JSONString)\n// 根据 Model 生成 JSON 字符串\nlet JSONString = Mapper().toJSONString(user, prettyPrint: true)\n```\n\nObjectMapper支持以下的类型映射到对象中：\n\n- `Int`\n- `Bool`\n- `Double`\n- `Float`\n- `String`\n- `RawRepresentable` (枚举)\n- `Array\u003cAnyObject\u003e`\n- `Dictionary\u003cString, AnyObject\u003e`\n- `Object\u003cT: Mappable\u003e`\n- `Array\u003cT: Mappable\u003e`\n- `Array\u003cArray\u003cT: Mappable\u003e\u003e`\n- `Set\u003cT: Mappable\u003e` \n- `Dictionary\u003cString, T: Mappable\u003e`\n- `Dictionary\u003cString, Array\u003cT: Mappable\u003e\u003e`\n- 以上所有的 Optional 类型\n- 以上所有的隐式强制解包类型（Implicitly Unwrapped Optional）\n\n## `Mappable` 协议\n\n#### `mutating func mapping(map: Map)` \n所有的映射最后都会调用到这个函数。当解析 JSON 时，这个函数会在对象创建成功后被执行。当生成 JSON 时就只有这个函数会被对象调用。\n\n#### `init?(map: Map)` \n这个可失败的初始化函数是 ObjectMapper 创建对象的时候使用的。开发者可以通过这个函数在映射前校验 JSON 。如果在这个方法里返回 nil 就不会执行 `mapping` 函数。可以通过传入的保存着 JSON 的  `Map` 对象进行校验：\n\n```swift\nrequired init?(map: Map){\n\t// 检查 JSON 里是否有一定要有的 \"name\" 属性\n\tif map.JSONDictionary[\"name\"] == nil {\n\t\treturn nil\n\t}\n}\n```\n\n## `StaticMappable` 协议\n`StaticMappable` 是 `Mappable` 之外的另一种选择。 这个协议可以让开发者通过一个静态函数初始化对象而不是通过 `init?(map: Map)`。\n\n注意: `StaticMappable` 和 `Mappable` 都继承了 `BaseMappable` 协议。 `BaseMappable` 协议声明了 `mapping(map: Map)` 函数。\n\n#### `static func objectForMapping(map: Map) -\u003e BaseMappable?` \nObjectMapper 使用这个函数获取对象后进行映射。开发者需要在这个函数里返回一个实现 `BaseMappable` 对象的实例。这个函数也可以用于：\n\n- 在对象进行映射前校验 JSON \n- 提供一个缓存过的对象用于映射\n- 返回另外一种类型的对象（当然是必须实现了 BaseMappable）用于映射。比如你可能通过检查 JSON 推断出用于映射的对象 ([看这个例子](https://github.com/Hearst-DD/ObjectMapper/blob/master/ObjectMapperTests/ClassClusterTests.swift#L62))。\n\n如果你需要在 extension 里实现 ObjectMapper，你需要选择这个协议而不是 `Mappable` 。\n\n## `ImmutableMappable` Protocol\n\n使用 `ImmutableMappable` 可以映射不可变的属性。下面的表格展示了 `ImmutableMappable` 和 `Mappable` 的不同：\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003cth\u003eImmutableMappable\u003c/th\u003e\n    \u003cth\u003eMappable\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth colspan=\"2\"\u003eProperties\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n\u003cstrong\u003elet\u003c/strong\u003e id: Int\n\u003cstrong\u003elet\u003c/strong\u003e name: String?\n\u003c/pre\u003e\n  \u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\nvar id: Int!\nvar name: String?\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth colspan=\"2\"\u003eJSON -\u003e Model\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\ninit(map: Map) \u003cstrong\u003ethrows\u003c/strong\u003e {\n  id   = \u003cstrong\u003etry\u003c/strong\u003e map.value(\"id\")\n  name = \u003cstrong\u003etry?\u003c/strong\u003e map.value(\"name\")\n}\n\u003c/pre\u003e\n  \u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\nmutating func mapping(map: Map) {\n  id   \u003c- map[\"id\"]\n  name \u003c- map[\"name\"]\n}\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth colspan=\"2\"\u003eModel -\u003e JSON\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\nmutating func mapping(map: Map) {\n  id   \u003cstrong\u003e\u003e\u003e\u003e\u003c/strong\u003e map[\"id\"]\n  name \u003cstrong\u003e\u003e\u003e\u003e\u003c/strong\u003e map[\"name\"]\n}\n\u003c/pre\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\nmutating func mapping(map: Map) {\n  id   \u003c- map[\"id\"]\n  name \u003c- map[\"name\"]\n}\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003cth colspan=\"2\"\u003eInitializing\u003c/th\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\n\u003cstrong\u003etry\u003c/strong\u003e User(JSONString: JSONString)\n\u003c/pre\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n\u003cpre\u003e\nUser(JSONString: JSONString)\n\u003c/pre\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n#### `init(map: Map) throws`\n\n这个可能抛出异常的初始化函数用于在提供的 `Map` 里映射不可变属性。每个不可变的初始化属性都要在这个初始化函数里初始化。\n\n当发生下列情况时初始化函数会抛出一个错误：\n\n- `Map` 根据提供的键名获取不到对应值\n- `Map` 使用 `Transform` 后没有得到值 \n\n`ImmutableMappable` 使用 `Map.value(_:using:)` 方法从  `Map` 中获取值。因为可能抛出异常，这个方法在使用时需要使用  `try` 关键字。 `Optional` 的属性可以简单的用  `try?` 处理。\n\n```swift\ninit(map: Map) throws {\n    name      = try map.value(\"name\") // throws an error when it fails\n    createdAt = try map.value(\"createdAt\", using: DateTransform()) // throws an error when it fails\n    updatedAt = try? map.value(\"updatedAt\", using: DateTransform()) // optional\n    posts     = (try? map.value(\"posts\")) ?? [] // optional + default value\n}\n```\n\n#### `mutating func mapping(map: Map)`\n\n这个方法是在 Model 转回 JSON 时调用的。因为不可变的属性不能被 `\u003c-` 映射，所以映射回来时需要使用 `\u003e\u003e\u003e` 。\n\n```swift\nmutating func mapping(map: Map) {\n    name      \u003e\u003e\u003e map[\"name\"]\n    createdAt \u003e\u003e\u003e (map[\"createdAt\"], DateTransform())\n    updatedAt \u003e\u003e\u003e (map[\"updatedAt\"], DateTransform())\n    posts     \u003e\u003e\u003e map[\"posts\"]\n}\n```\n# 轻松映射嵌套对象\n\nObjectMapper 支持使用点语法来轻松实现嵌套对象的映射。比如有如下的 JSON 字符串：\n\n```json\n\"distance\" : {\n     \"text\" : \"102 ft\",\n     \"value\" : 31\n}\n```\n你可以通过这种写法直接访问到嵌套对象：\n\n```swift\nfunc mapping(map: Map) {\n    distance \u003c- map[\"distance.value\"]\n}\n```\n嵌套的键名也支持访问数组中的值。如果有一个返回的 JSON 是一个包含 distance 的数组，可以通过这种写法访问：\n\n```\ndistance \u003c- map[\"distances.0.value\"]\n```\n如果你的键名刚好含有 `.` 符号，你需要特别声明关闭上面提到的获取嵌套对象功能：\n\n```swift\nfunc mapping(map: Map) {\n    identifier \u003c- map[\"app.identifier\", nested: false]\n}\n```\n如果刚好有嵌套的对象的键名还有 `.` ,可以在中间加入一个自定义的分割符（[#629](https://github.com/Hearst-DD/ObjectMapper/pull/629)）:\n```swift\nfunc mapping(map: Map) {\n    appName \u003c- map[\"com.myapp.info-\u003ecom.myapp.name\", delimiter: \"-\u003e\"]\n}\n```\n这种情况的 JSON 是这样的：\n\n```json\n\"com.myapp.info\" : {\n     \"com.myapp.name\" : \"SwiftOldDriver\"\n}\n```\n\n# 自定义转换规则\nObjectMapper 也支持在映射时自定义转换规则。如果要使用自定义转换，创建一个 tuple（元祖）包含 ```map[\"field_name\"]``` 和你要使用的变换放在 ```\u003c-``` 的右边：\n\n```swift\nbirthday \u003c- (map[\"birthday\"], DateTransform())\n```\n当解析 JSON 时上面的转换会把 JSON 里面的 Int 值转成一个 NSDate ，如果是对象转为 JSON 时，则会把 NSDate 对象转成 Int 值。\n\n只要实现```TransformType``` 协议就可以轻松的创建自定义的转换规则：\n\n```swift\npublic protocol TransformType {\n    associatedtype Object\n    associatedtype JSON\n\n    func transformFromJSON(_ value: Any?) -\u003e Object?\n    func transformToJSON(_ value: Object?) -\u003e JSON?\n}\n```\n\n### TransformOf\n大多数情况下你都可以使用框架提供的转换类 ```TransformOf``` 来快速的实现一个期望的转换。 ```TransformOf``` 的初始化需要两个类型和两个闭包。两个类型声明了转换的目标类型和源类型，闭包则实现具体转换逻辑。\n\n举个例子，如果你想要把一个 JSON 字符串转成 Int ，你可以像这样使用 ```TransformOf``` ：\n\n```swift\nlet transform = TransformOf\u003cInt, String\u003e(fromJSON: { (value: String?) -\u003e Int? in \n    // 把值从 String? 转成 Int?\n    return Int(value!)\n}, toJSON: { (value: Int?) -\u003e String? in\n    // 把值从 Int? 转成 String?\n    if let value = value {\n        return String(value)\n    }\n    return nil\n})\n\nid \u003c- (map[\"id\"], transform)\n```\n这是一种更省略的写法：\n\n```swift\nid \u003c- (map[\"id\"], TransformOf\u003cInt, String\u003e(fromJSON: { Int($0!) }, toJSON: { $0.map { String($0) } }))\n```\n# 继承\n\n实现了  ```Mappable``` 协议的类可以容易的被继承。当继承一个 mappable 的类时，使用这样的结构：\n\n```swift\nclass Base: Mappable {\n\tvar base: String?\n\t\n\trequired init?(map: Map) {\n\n\t}\n\n\tfunc mapping(map: Map) {\n\t\tbase \u003c- map[\"base\"]\n\t}\n}\n\nclass Subclass: Base {\n\tvar sub: String?\n\n\trequired init?(map: Map) {\n\t\tsuper.init(map)\n\t}\n\n\toverride func mapping(map: Map) {\n\t\tsuper.mapping(map)\n\t\t\n\t\tsub \u003c- map[\"sub\"]\n\t}\n}\n```\n\n注意确认子类中的实现调用了父类中正确的初始化器和映射函数。\n\n# 泛型对象\n\nObjectMapper 可以处理泛型只要这个泛型也实现了`Mappable`协议。看这个例子：\n\n```swift\nclass Result\u003cT: Mappable\u003e: Mappable {\n    var result: T?\n\n    required init?(map: Map){\n\n    }\n\n    func mapping(map: Map) {\n        result \u003c- map[\"result\"]\n    }\n}\n\nlet result = Mapper\u003cResult\u003cUser\u003e\u003e().map(JSON)\n```\n# 映射时的上下文对象\n\n`Map` 是在映射时传入的对象，带有一个 optional  `MapContext` 对象，开发者可以通过使用这个对象在映射时传入一些信息。\n\n为了使用这个特性，需要先创建一个对象实现了 `MapContext` 协议（这个协议是空的），然后在初始化时传入 `Mapper` 中。\n\n```swift\nstruct Context: MapContext {\n\tvar importantMappingInfo = \"映射时需要知道的额外信息\"\n}\n\nclass User: Mappable {\n\tvar name: String?\n\t\n\trequired init?(map: Map){\n\t\n\t}\n\t\n\tfunc mapping(map: Map){\n\t\tif let context = map.context as? Context {\n\t\t\t// 获取到额外的信息\n\t\t}\n\t}\n}\n\nlet context = Context()\nlet user = Mapper\u003cUser\u003e(context: context).map(JSONString)\n```\n\n# ObjectMapper + Alamofire\n\n如果网络层你使用的是  [Alamofire](https://github.com/Alamofire/Alamofire) ，并且你希望把返回的结果转换成 Swift 对象，你可以使用 [AlamofireObjectMapper](https://github.com/tristanhimmelman/AlamofireObjectMapper) 。这是一个使用 ObjectMapper 实现的把返回的 JSON 自动转成 Swift 对象的 Alamofire 的扩展。 \n\n\n# ObjectMapper + Realm\n\nObjectMapper 可以和 Realm 一起配合使用。使用下面的声明结构就可以使用 ObjectMapper 生成 Realm 对象：\n\n```swift\nclass Model: Object, Mappable {\n\tdynamic var name = \"\"\n\n\trequired convenience init?(map: Map) {\n\t\tself.init()\n\t}\n\n\tfunc mapping(map: Map) {\n\t\tname \u003c- map[\"name\"]\n\t}\n}\n```\n\n如果你想要序列化相关联的 RealmObject，你可以使用 [ObjectMapper+Realm](https://github.com/jakenberg/ObjectMapper-Realm)。这是一个简单的 Realm 扩展，用于把任意的 JSON 序列化成 Realm 的类（ealm's List class。）\n\n注意：使用 ObjectMappers 的 `toJSON` 函数来生成 JSON 字符串只在 Realm 的写事务中有效（write transaction）。这是因为 ObjectMapper 在解析和生成时在映射函数（ `\u003c-` ）中使用  `inout` 作为标记（ flag ）。Realm 会检测到标记并且强制要求 `toJSON` 函数只能在一个写的事务中调用，即使这个对象并没有被修改。\n\n# 待完成\n- 改善错误的处理。可能使用 `throws` 来处理。\n- 相关类的文档完善\n\n# 安装\n### Cocoapods\n如果你的项目使用 [CocoaPods 0.36 及以上](http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/) 的版本，你可以把下面内容添加到在 `Podfile` 中，将 ObjectMapper 添加到你的项目中:\n\n```ruby\npod 'ObjectMapper', '~\u003e 2.2'\n```\n\n### Carthage\n如果你的项目使用  [Carthage](https://github.com/Carthage/Carthage) ，你可以把下面的内容添加到 `Cartfile` 中，将 ObjectMapper 的依赖到你的项目中：\n\n```\ngithub \"Hearst-DD/ObjectMapper\" ~\u003e 2.2\n```\n\n### Swift Package Manager\n如果你的项目使用  [Swift Package Manager](https://swift.org/package-manager/) ，那么你可以把下面内容添加到 `Package.swift` 中的 `dependencies` 数组中，将 ObjectMapper 的依赖到你的项目中：\n\n```swift\n.Package(url: \"https://github.com/Hearst-DD/ObjectMapper.git\", majorVersion: 2, minor: 2),\n```\n\n\n### Submodule\n此外，ObjectMapper 也可以作为一个 submodule 添加到项目中：\n\n1. 打开终端，使用 `cd` 命令进入项目文件的根目录下，然后在终端中输入 `git submodule add https://github.com/Hearst-DD/ObjectMapper.git` ，把 ObjectMapper 作为项目的一个 [submodule](http://git-scm.com/docs/git-submodule) 添加进来。\n2. 打开 `ObjectMapper` 文件，并将 `ObjectMapper.xcodeproj` 拖进你 app 项目的文件导航中。\n3. 在 Xcode 中，文件导航中点击蓝色项目图标进入到 target 配置界面，在侧边栏的 \"TARGETS\" 下选择主工程对应的target。\n4. 确保 `ObjectMapper.framework` 的部署版本( deployment target )和主工程的部署版本保持一致。\n5. 在配置界面的顶部选项栏中，打开 \"Build Phases\" 面板。\n6. 展开 \"Target Dependencies\" 组，并添加 `ObjectMapper.framework` 。\n7. 点击面板左上角的 `+` 按钮,选择 \"New Copy Files Phase\"。将这个阶段重命名为 \"Copy Frameworks\"，设置  \"Destination\" 为 \"Frameworks\"，最后添加 `ObjectMapper.framework` 。  \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanhimmelman%2FObjectMapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftristanhimmelman%2FObjectMapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanhimmelman%2FObjectMapper/lists"}