-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift 3 #103
Swift 3 #103
Conversation
Swift 3 fixes
Pointing to phatblat/swift-3 branch
warning: FetchedResultsController.swift:93:198: Extraneous duplicate parameter name; 'newIndexPath' already has an argument label
Strange build issue is resolved in Xcode 8b2 (8S162m) 🎉 |
What is the status of this PR? Will this be released soon? |
Sorry I will try to pick up on this next week. Realm is announcing something new next week and I have been heads down all summer. |
@phatblat @bigfish24 any ETA on the Swift 3 support? |
Can someone take a look at this perhaps? Thank you for support! |
Ok, It seems that no one is willing to merge this. @phatblat Thank you very much for this update, I was unfortunately unable to get this working with your forked pods, could you point me to correct way how to get this working temporarily? Thank you |
@syky27 You can install an unreleased version of a pod from a branch using the following: pod 'RBQFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3' |
Almost forgot, since RBQSafeRealmObject is a dependency of this library and its Swift 3 migration is still (in-progress](Roobiq/RBQSafeRealmObject#2), you'll want to include it from a branch as well, but that dependency should be before RBQFetchedResultsController, so that it uses the modified version instead of a released version. pod 'RBQSafeRealmObject', git: 'https://github.com/phatblat/RBQSafeRealmObject.git', branch: 'swift-3'
pod 'RBQFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3' |
Well this is getting better, @phatblat I was trying that exactly as you suggested now, but I still could not build because some error, and now when I wanted to give you the error, cocoapods are acting crazy, I need to do @bigfish24 Sorry for being such pain in the ass. |
Not in the slightest! This is entirely my fault and I should have addressed it far sooner. |
@phatblat So I fixed my cocoapods installation the build error I am getting is:
In |
@syky27 do you have use_frameworks! In your Podfile? That import needs to be changed to work with frameworks/modules. I'll update it tomorrow. |
@bigfish24 thanks for adding me as a contributor! I'll double check my changes, test them in Xcode 8.1 and merge when things look good. |
Hi, @phatblat did you find a time to get to this? |
Could someone please merge this? Or at least provide me with solution? @phatblat you said that the import needs to be changed but you did not provide me with solution. I know that I am really pressing on this, it's kinda critical for me. Thank you in advance. |
And when I build and run the project I am getting SIGABRT in With following:
EDIT: Just realizing this is Realm thing.... I will try to update it I might running wrong version.... but shouldn't RBQFetchedResultsController have dependency on Realm, and if so is't it fetching wrong version.... 🤔 -- Runnning EDIT2: I guess It is too late for my brain it is just not working.... EDIT above is complete nonsense, sorry. The problem is obviously described above. I either cannot read English anymore or my prescription glasses ain't working. |
What are the missing pieces to get this change merged? This is the last piece that our project needs to fully convert to Swift 3 / xCode 8. |
This PR is the only thing keeping me from choosing Realm for my projects at work and at home. I know, it's open source and all that, but unless Realm has a drop-in replacement for the fetched results controller, it's a really tough sell to the team. It would be nice if the nice folks at Realm could supply this and not rely on a third-party to provide it. |
Sorry for the delay in finishing this up. I believe all the changes necessary are done, I just haven't been able to test it to verify that everything is working correctly. I'll plan to merge this tomorrow, allowing one last day for feedback. |
@phatblat see my last comment I am getting an error |
Ah, I'm getting the same error when running the "Swift" (no suffix) example project.
|
It's blowing up in It looks like RealmSwift assumes that all objects that are part of the schema will be instances of |
Ok will look into, I am sure I can find a way to convert between the types. |
What's the reason that these cache objects extend |
Nevermind. I see now that they are being stored in a |
This is actually an odd bug because typically at Realm we don't recommend to mix ObjC and Swift together, so the ObjC class definition actually doesn't play nice with the |
Ok this is really ugly but using Swift's limited reflection here is how I could get around it: // Hack to get around issue with cache objects appearing in Realm
// when building RBQFRC not as a framework
let mirror = Mirror(reflecting: configuration)
for child in mirror.children {
if "customSchema" == child.label {
let customSchema = child.value as! RLMSchema
let schemaSubset = customSchema.objectSchema.filter({ (objectSchema) -> Bool in
let cacheObjectNames = ["RBQControllerCacheObject",
"RBQObjectCacheObject",
"RBQSectionCacheObject"]
if cacheObjectNames.contains(objectSchema.objectName) {
return false
}
return true
})
rlmConfiguration.objectClasses = schemaSubset.map { $0.objectClass }
}
} |
rlmConfiguration.syncConfiguration = RLMSyncConfiguration(user: syncConfig.user, realmURL: syncConfig.realmURL) | ||
} | ||
|
||
if let objectTypes = configuration.objectTypes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace with this for now:
// Hack to get around issue with cache objects appearing in Realm
// when building RBQFRC not as a framework
let mirror = Mirror(reflecting: configuration)
for child in mirror.children {
if "customSchema" == child.label {
let customSchema = child.value as! RLMSchema
let schemaSubset = customSchema.objectSchema.filter({ (objectSchema) -> Bool in
let cacheObjectNames = ["RBQControllerCacheObject",
"RBQObjectCacheObject",
"RBQSectionCacheObject"]
if cacheObjectNames.contains(objectSchema.objectName) {
return false
}
return true
})
rlmConfiguration.objectClasses = schemaSubset.map { $0.objectClass }
}
}
With my change this should be good to go to merge 👍 |
We can remove this hack once a new release of Realm Swift is released that exposes converter functions to support interoperability of Swift and ObjC Realm objects: https://github.com/realm/realm-cocoa/blob/master/RealmSwift/ObjectiveCSupport.swift#L139-L147 |
Barring surprises, we're planning on releasing Realm Swift 2.1.1 today. |
2.1.1 is out: https://github.com/realm/realm-cocoa/releases/tag/v2.1.1 |
Let's get this fix in for backwards compatibility and then update to use new 2.1.1 APIs |
Sounds good |
…uilding RBQFRC not as a framework
LGTM. Thanks everyone for helping with this long-running PR! |
👏🎉🎉 |
Ran the Swift 3 migration tool and updated the RealmSwift API for the changes in master.
master
branch of realm-cocoaWill redo submodule commit after dependent PR is merged.Dependendencies now integrated using CocoaPods instead of git submodules
Fixes phatblat#1