ios - Realm 生成模型
<p><p>我一直关注<a href="http://www.appcoda.com/realm-database-swift/" rel="noreferrer noopener nofollow">this</a>关于 Realm 的教程,我遇到了障碍。
所以它说要生成一个 Realm 模型,为此我们必须通过 Alcaraz 在 Xcode 中安装一个插件。 Shiny 。</p>
<p>现在我面临的问题是,在 Xcode 8+ 中它不允许安装任何外部插件(据我所知,只有那些可以编辑文本的插件)。</p>
<p>我的问题是我如何像本教程所说的那样生成 Realm 模型,现在 Xcode 8+ 不支持外部插件。此外,如果现在不可能,那么我应该如何处理/解决数据模型的这种映射。</p>
<p>我在 Realms git 页面或他们的网站上没有找到任何解决方案。
任何帮助表示赞赏。</p>
<p>我正在使用 Xcode 8.3.2,我正在开发 Swift 3.1</p>
<h1>编辑</h1>
<p>我已经通过 cocoapods 安装了 Realm。我在问是否有像 Core Data xcdatamodel 这样的可视化生成器,用于 Realm Data 模型,就像以前在 Xcode 插件中一样。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>You can use CocoaPods
add following to pods file and install -pod install
pod 'Realm', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
pod 'RealmSwift', git: 'https://github.com/realm/realm-cocoa.git', branch: 'master', submodules: true
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
then , Create model class as following
import Foundation
import UIKit
import RealmSwift
import Realm
class ClassName: Object{
required init(value: Any, schema: RLMSchema) {
super.init(value : value,schema:schema)
//fatalError("init(value:schema:) has not been implemented")
}
required init() {
super.init()
//fatalError("init() has not been implemented")
}
required init(realm: RLMRealm, schema: RLMObjectSchema) {
super.init(realm:realm , schema:schema)
//fatalError("init(realm:schema:) has not been implemented")
}
}
</code></pre></p>
<p style="font-size: 20px;">关于ios -Realm 生成模型,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/44198781/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/44198781/
</a>
</p>
页:
[1]