Roobiq / RBQFetchedResultsController

Drop-in replacement for NSFetchedResultsController backed by Realm.
MIT License
477 stars 70 forks source link

Swift 3 #103

Closed phatblat closed 7 years ago

phatblat commented 8 years ago

Ran the Swift 3 migration tool and updated the RealmSwift API for the changes in master.

Dependendencies now integrated using CocoaPods instead of git submodules

Fixes phatblat/RBQFetchedResultsController#1

phatblat commented 8 years ago

Strange build issue is resolved in Xcode 8b2 (8S162m) 🎉

RyanCodes commented 8 years ago

What is the status of this PR? Will this be released soon?

bigfish24 commented 8 years ago

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.

cezarywojcik commented 7 years ago

@phatblat @bigfish24 any ETA on the Swift 3 support?

syky27 commented 7 years ago

Can someone take a look at this perhaps?

Thank you for support!

syky27 commented 7 years ago

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

phatblat commented 7 years ago

@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'
phatblat commented 7 years ago

Almost forgot, since RBQSafeRealmObject is a dependency of this library and its Swift 3 migration is still (in-progress](https://github.com/Roobiq/RBQSafeRealmObject/pull/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'
bigfish24 commented 7 years ago

@phatblat and @syky27 sorry this has sat idle for so long. Not much I can say other than I sincerely apologize. Added @phatblat as a contributor to both repos... if things are ready do you want to merge, if not I can do so too?

syky27 commented 7 years ago

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 gem cleanup in a sec, cannot really do it now... I will keep you posted.

@bigfish24 Sorry for being such pain in the ass.

bigfish24 commented 7 years ago

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.

syky27 commented 7 years ago

@phatblat So I fixed my cocoapods installation the build error I am getting is:

/Users/syky/optify/optify-ios/Pods/RBQFetchedResultsController/RBQFetchedResultsController/Source/CacheObjects/RBQObjectCacheObject.h:10:9: 'RBQSafeRealmObject.h' file not found

In RBQObjectCacheObject.h file.

phatblat commented 7 years ago

@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.

phatblat commented 7 years ago

@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.

syky27 commented 7 years ago

Hi, @phatblat did you find a time to get to this?

syky27 commented 7 years ago

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.

phatblat commented 7 years ago

@syky27 I think I fixed the issues. I was more than just the import, there was a missing dependency in the pod specs as well. My swift-3 branches have the fix now.

Now just need to review these changes in a real app to make sure I've caught everything. If you have a chance to test these changes, that would help a lot!

syky27 commented 7 years ago

Thanks you @phatblat, that is what I thought, because even when I was using your branch I was not able to compile this due missing dependencies.

Thank you for the hard work. I will try to test it later today.

Is this all I need to do?

pod 'RBQSafeRealmObject', git: 'https://github.com/phatblat/RBQSafeRealmObject.git', branch: 'swift-3'
pod 'RBQFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3'
syky27 commented 7 years ago

@phatblat Hi, I am still unable to build, still getting this:

'RBQSafeRealmObject.h' file not found

This is my podfile:

  pod 'RBQSafeRealmObject', git: 'https://github.com/phatblat/RBQSafeRealmObject.git', branch: 'swift-3'
  pod 'SwiftFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3'

Is it on my side, does your fix work? Or is it still WIP?

phatblat commented 7 years ago

@syky27 This is still a WIP. I forgot that this repo has RBQSafeRealmObject and RealmUtilities included as git submodules. That may be why you're getting the "file not found" error. CocoaPods doesn't init submodules when dependencies are included from a branch unless you add submodules: true. However, when I got past that error, I got several "duplicate symbols" errors because the dependencies are being included twice.

I'm going to try removing the submodules now that CocoaPods knows about this library's dependencies.

syky27 commented 7 years ago

Hi, even after you removed submodules, nothing has changed for me :(

phatblat commented 7 years ago

@syky27 Strange. Removing the submodules resolved the import issues in the cocoapods example projects. Make sure to run pod update so that CocoaPods pulls in the latest commit instead of using the one in your Podfile.lock.

syky27 commented 7 years ago

@phatblat So I have deintegrated cocoapods, removed Podfile.lock, cleaned project & derived data, basically I tried everything... My Podfile looks like this:

# Uncomment this line to define a global platform for your project
 platform :ios, '9.0'

target 'OPTIFY' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for OPTIFY
...
...
...
  # REALM
  pod 'RealmSwift'
  pod 'SwiftFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3', :submodules => true

...
...
...

  target 'OPTIFYTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'OPTIFYUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end

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

And I am still getting this: screenshot 2016-11-12 16 23 55

In RBQSafeRealmObject.m

And I am getting same result even if I add your RBQSafeRealmObject from https://github.com/phatblat/RBQSafeRealmObject.git to Podfile.

  pod 'RealmSwift'
  pod 'SwiftFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3', :submodules => true
  pod 'RBQSafeRealmObject', git: 'https://github.com/phatblat/RBQSafeRealmObject.git', branch: 'swift-3'

At the end I will migrate everything to Carthage. I saw you added support for new version, so I am gonna test it now.

syky27 commented 7 years ago

Because I still for some reason have v0.7.1 of RealmObject

So I changed my Podfile config to config.build_settings['SWIFT_VERSION'] = '3.0.1'

I successfully pulled RealmObject version v1.0.0

And I am still getting the very same result. I thought hard and tried everything, and I still have no clue what am I doing wrong.... :(

syky27 commented 7 years ago

HI, I got further this time but I am getting nasty seg. fault

CompileSwift normal arm64 /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift
    cd /Users/syky/optify/optify-ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/syky/optify/optify-ios/OPTIFY/APIWrapper.swift /Users/syky/optify/optify-ios/OPTIFY/K.swift /Users/syky/optify/optify-ios/OPTIFY/Examination.swift /Users/syky/optify/optify-ios/OPTIFY/ExaminationForm.swift /Users/syky/optify/optify-ios/OPTIFY/AppDelegate.swift -primary-file /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/CustomersTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerValidator.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerForm.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Customer.swift /Users/syky/optify/optify-ios/OPTIFY/Device.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Examination.swift /Users/syky/optify/optify-ios/OPTIFY/Randomizer.swift /Users/syky/optify/optify-ios/OPTIFY/Customer.swift -target arm64-apple-ios9.3 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -I /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Alamofire -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Eureka -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Localize-Swift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/PKHUD -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQSafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Realm -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmSwift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmUtilities -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftyJSON -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Validator -F /Users/syky/optify/optify-ios/Pods/Crashlytics/iOS -F /Users/syky/optify/optify-ios/Pods/Fabric/iOS -F /Users/syky/optify/optify-ios/Carthage/Build/iOS -enable-testing -g -module-cache-path /Users/syky/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -D COCOAPODS -D DEBUG -serialize-debugging-options -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-generated-files.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-own-target-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-project-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/include -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Crashlytics -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Fabric -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources/arm64 -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/syky/optify/optify-ios -emit-module-doc-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftdoc -Onone -module-name OPTIFY -emit-module-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftmodule -serialize-diagnostics-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.dia -emit-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.d -emit-reference-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.swiftdeps -o /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.o -embed-bitcode-marker

/Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:144:109: error: use of undeclared type 'SafeObject'
    public func controller<T : Object>(_ controller: FetchedResultsController<T>, didChangeObject anObject: SafeObject<T>, atIndexPath indexPath: IndexPath, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath) {
                                                                                                            ^~~~~~~~~~
/Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:151:101: error: use of undeclared type 'RealmSafeObject'
    func controllerDidChangeObject<T : Object>(_ controller: FetchedResultsController<T>, anObject: RealmSafeObject<T>, indexPath: IndexPath?, changeType: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
                                                                                                    ^~~~~~~~~~~~~~~
<built-in>:2:14: note: in module 'RBQFetchedResultsController' imported from <built-in>:3:
#define __clang__ 1
             ^
/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQFetchedResultsController/RBQFetchedResultsController.framework/Headers/RLMObject+SafeObject.h:16:12: warning: duplicate definition of category 'SafeObject' on interface 'RLMObject'
@interface RLMObject (SafeObject)
           ^
/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQSafeRealmObject/RBQSafeRealmObject.framework/Headers/RLMObject+SafeObject.h:16:12: note: previous definition is here
@interface RLMObject (SafeObject)
           ^
0  swift                    0x0000000107bf3a3d PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x0000000107bf3466 SignalHandler(int) + 470
2  libsystem_platform.dylib 0x00007fffb4e9cbba _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1259746400
4  swift                    0x00000001055808a6 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 806
5  swift                    0x0000000105581610 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 4240
6  swift                    0x00000001055809f3 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1139
7  swift                    0x0000000105580b2e swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1454
8  swift                    0x00000001055820dc swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 7004
9  swift                    0x000000010557e294 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 39268
10 swift                    0x0000000105589367 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 647
11 swift                    0x000000010579c4ea (anonymous namespace)::hasFailableInits(swift::NominalTypeDecl*, swift::constraints::ConstraintSystem*) + 362
12 swift                    0x000000010579bfd2 (anonymous namespace)::ConstraintGenerator::visitApplyExpr(swift::ApplyExpr*) + 642
13 swift                    0x00000001057959d0 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 64
14 swift                    0x000000010590ea0c (anonymous namespace)::Traversal::visit(swift::Expr*) + 6812
15 swift                    0x0000000105791368 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 424
16 swift                    0x00000001057cdd0a swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 4570
17 swift                    0x000000010580df62 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 482
18 swift                    0x0000000105810576 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 630
19 swift                    0x0000000105892d38 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 488
20 swift                    0x0000000105891d5d swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 365
21 swift                    0x00000001058963fc swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 188
22 swift                    0x0000000105849aba swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 6714
23 swift                    0x00000001054f931b swift::CompilerInstance::performSema() + 5675
24 swift                    0x0000000104f9ca4d performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2765
25 swift                    0x0000000104f99f70 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17856
26 swift                    0x0000000104f5693e main + 8302
27 libdyld.dylib            0x00007fffb4c8f255 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/syky/optify/optify-ios/OPTIFY/APIWrapper.swift /Users/syky/optify/optify-ios/OPTIFY/K.swift /Users/syky/optify/optify-ios/OPTIFY/Examination.swift /Users/syky/optify/optify-ios/OPTIFY/ExaminationForm.swift /Users/syky/optify/optify-ios/OPTIFY/AppDelegate.swift -primary-file /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/CustomersTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerValidator.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerForm.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Customer.swift /Users/syky/optify/optify-ios/OPTIFY/Device.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Examination.swift /Users/syky/optify/optify-ios/OPTIFY/Randomizer.swift /Users/syky/optify/optify-ios/OPTIFY/Customer.swift -target arm64-apple-ios9.3 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -I /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Alamofire -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Eureka -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Localize-Swift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/PKHUD -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQSafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Realm -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmSwift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmUtilities -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftyJSON -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Validator -F /Users/syky/optify/optify-ios/Pods/Crashlytics/iOS -F /Users/syky/optify/optify-ios/Pods/Fabric/iOS -F /Users/syky/optify/optify-ios/Carthage/Build/iOS -enable-testing -g -module-cache-path /Users/syky/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -D COCOAPODS -D DEBUG -serialize-debugging-options -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-generated-files.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-own-target-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-project-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/include -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Crashlytics -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Fabric -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources/arm64 -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/syky/optify/optify-ios -emit-module-doc-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftdoc -Onone -module-name OPTIFY -emit-module-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftmodule -serialize-diagnostics-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.dia -emit-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.d -emit-reference-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.swiftdeps -o /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.o -embed-bitcode-marker 
1.  While type-checking 'viewDidLoad' at /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:27:14
2.  While type-checking expression at [/Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:47:3 - line:47:156] RangeText="self.fetchedResultsController = FetchedResultsController<Examination>(fetchRequest: fetchRequest, sectionNameKeyPath: "examinationID", cacheName: "cache")"
3.  While loading members for declaration 0x7fc31596e250 at <invalid loc>
4.  While deserializing 'controller' (FuncDecl #157) 
phatblat commented 7 years ago

I missed an import. That error is fixed now in Roobiq/RBQSafeRealmObject#5 released as 1.0.1. My swift-3 branch is now outdated.

syky27 commented 7 years ago

OK, well while Using RBQSafeRealmObject (1.0.1)

screenshot 2016-11-12 18 21 31

File not found in RBQSafeRealmObject.m

phatblat commented 7 years ago

Ah, the problem is in the Swift spec. It's including an old file, but resolving that leads to duplicate symbols. I'll have a fix up for the spec later.

syky27 commented 7 years ago

Just did screenshot 2016-11-12 19 26 24

Seg fault:

CompileSwift normal arm64 /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift
    cd /Users/syky/optify/optify-ios
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/syky/optify/optify-ios/OPTIFY/APIWrapper.swift /Users/syky/optify/optify-ios/OPTIFY/K.swift /Users/syky/optify/optify-ios/OPTIFY/Examination.swift /Users/syky/optify/optify-ios/OPTIFY/ExaminationForm.swift /Users/syky/optify/optify-ios/OPTIFY/AppDelegate.swift -primary-file /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/CustomersTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerValidator.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerForm.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Customer.swift /Users/syky/optify/optify-ios/OPTIFY/Device.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Examination.swift /Users/syky/optify/optify-ios/OPTIFY/Randomizer.swift /Users/syky/optify/optify-ios/OPTIFY/Customer.swift -target arm64-apple-ios9.3 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -I /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Alamofire -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Eureka -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Localize-Swift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/PKHUD -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQSafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Realm -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmSwift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmUtilities -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftyJSON -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Validator -F /Users/syky/optify/optify-ios/Pods/Crashlytics/iOS -F /Users/syky/optify/optify-ios/Pods/Fabric/iOS -F /Users/syky/optify/optify-ios/Carthage/Build/iOS -enable-testing -g -module-cache-path /Users/syky/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -D COCOAPODS -D DEBUG -serialize-debugging-options -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-generated-files.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-own-target-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-project-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/include -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Crashlytics -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Fabric -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources/arm64 -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/syky/optify/optify-ios -emit-module-doc-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftdoc -Onone -module-name OPTIFY -emit-module-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftmodule -serialize-diagnostics-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.dia -emit-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.d -emit-reference-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.swiftdeps -o /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.o -embed-bitcode-marker

/Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:144:109: error: use of undeclared type 'SafeObject'
    public func controller<T : Object>(_ controller: FetchedResultsController<T>, didChangeObject anObject: SafeObject<T>, atIndexPath indexPath: IndexPath, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath) {
                                                                                                            ^~~~~~~~~~
/Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:151:101: error: use of undeclared type 'SafeObject'
    func controllerDidChangeObject<T : Object>(_ controller: FetchedResultsController<T>, anObject: SafeObject<T>, indexPath: IndexPath?, changeType: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
                                                                                                    ^~~~~~~~~~
<built-in>:2:14: note: in module 'RBQFetchedResultsController' imported from <built-in>:3:
#define __clang__ 1
             ^
/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQFetchedResultsController/RBQFetchedResultsController.framework/Headers/RLMObject+SafeObject.h:16:12: warning: duplicate definition of category 'SafeObject' on interface 'RLMObject'
@interface RLMObject (SafeObject)
           ^
/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQSafeRealmObject/RBQSafeRealmObject.framework/Headers/RLMObject+SafeObject.h:16:12: note: previous definition is here
@interface RLMObject (SafeObject)
           ^
0  swift                    0x000000010536ea3d PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x000000010536e466 SignalHandler(int) + 470
2  libsystem_platform.dylib 0x00007fffb4e9cbba _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1259746400
4  swift                    0x0000000102cfb8a6 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 806
5  swift                    0x0000000102cfc610 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 4240
6  swift                    0x0000000102cfb9f3 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1139
7  swift                    0x0000000102cfbb2e swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 1454
8  swift                    0x0000000102cfd0dc swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 7004
9  swift                    0x0000000102cf9294 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 39268
10 swift                    0x0000000102d04367 swift::ModuleFile::loadAllMembers(swift::Decl*, unsigned long long) + 647
11 swift                    0x0000000102f174ea (anonymous namespace)::hasFailableInits(swift::NominalTypeDecl*, swift::constraints::ConstraintSystem*) + 362
12 swift                    0x0000000102f16fd2 (anonymous namespace)::ConstraintGenerator::visitApplyExpr(swift::ApplyExpr*) + 642
13 swift                    0x0000000102f109d0 (anonymous namespace)::ConstraintWalker::walkToExprPost(swift::Expr*) + 64
14 swift                    0x0000000103089a0c (anonymous namespace)::Traversal::visit(swift::Expr*) + 6812
15 swift                    0x0000000102f0c368 swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*) + 424
16 swift                    0x0000000102f48d0a swift::constraints::ConstraintSystem::solve(swift::Expr*&, swift::Type, swift::ExprTypeCheckListener*, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::FreeTypeVariableBinding) + 4570
17 swift                    0x0000000102f88f62 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 482
18 swift                    0x0000000102f8b576 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 630
19 swift                    0x000000010300dd38 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 488
20 swift                    0x000000010300cd5d swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) + 365
21 swift                    0x00000001030113fc swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) + 188
22 swift                    0x0000000102fc4aba swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 6714
23 swift                    0x0000000102c7431b swift::CompilerInstance::performSema() + 5675
24 swift                    0x0000000102717a4d performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2765
25 swift                    0x0000000102714f70 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17856
26 swift                    0x00000001026d193e main + 8302
27 libdyld.dylib            0x00007fffb4c8f255 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/syky/optify/optify-ios/OPTIFY/APIWrapper.swift /Users/syky/optify/optify-ios/OPTIFY/K.swift /Users/syky/optify/optify-ios/OPTIFY/Examination.swift /Users/syky/optify/optify-ios/OPTIFY/ExaminationForm.swift /Users/syky/optify/optify-ios/OPTIFY/AppDelegate.swift -primary-file /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/CustomersTableViewController.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerValidator.swift /Users/syky/optify/optify-ios/OPTIFY/NewCustomerForm.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Customer.swift /Users/syky/optify/optify-ios/OPTIFY/Device.swift /Users/syky/optify/optify-ios/OPTIFY/APIWrapper+Examination.swift /Users/syky/optify/optify-ios/OPTIFY/Randomizer.swift /Users/syky/optify/optify-ios/OPTIFY/Customer.swift -target arm64-apple-ios9.3 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.1.sdk -I /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Alamofire -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Eureka -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Localize-Swift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/PKHUD -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RBQSafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Realm -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmSwift -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/RealmUtilities -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SafeRealmObject -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftFetchedResultsController -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/SwiftyJSON -F /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/Validator -F /Users/syky/optify/optify-ios/Pods/Crashlytics/iOS -F /Users/syky/optify/optify-ios/Pods/Fabric/iOS -F /Users/syky/optify/optify-ios/Carthage/Build/iOS -enable-testing -g -module-cache-path /Users/syky/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -D COCOAPODS -D DEBUG -serialize-debugging-options -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-generated-files.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-own-target-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/OPTIFY-project-headers.hmap -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Products/Debug-iphoneos/include -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Crashlytics -Xcc -I/Users/syky/optify/optify-ios/Pods/Headers/Public/Fabric -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources/arm64 -Xcc -I/Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/syky/optify/optify-ios -emit-module-doc-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftdoc -Onone -module-name OPTIFY -emit-module-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController~partial.swiftmodule -serialize-diagnostics-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.dia -emit-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.d -emit-reference-dependencies-path /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.swiftdeps -o /Users/syky/Library/Developer/Xcode/DerivedData/OPTIFY-gniqdvszrvdjhwaqvfoeylrkkksg/Build/Intermediates/OPTIFY.build/Debug-iphoneos/OPTIFY.build/Objects-normal/arm64/ExaminationsTableViewController.o -embed-bitcode-marker 
1.  While type-checking 'viewDidLoad' at /Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:27:14
2.  While type-checking expression at [/Users/syky/optify/optify-ios/OPTIFY/ExaminationsTableViewController.swift:47:3 - line:47:156] RangeText="self.fetchedResultsController = FetchedResultsController<Examination>(fetchRequest: fetchRequest, sectionNameKeyPath: "examinationID", cacheName: "cache")"
3.  While loading members for declaration 0x7fb04422f650 at <invalid loc>
4.  While deserializing 'controller' (FuncDecl #157) 
phatblat commented 7 years ago

Thanks for this detail! Buried in that output are two issues:

  1. ExaminationsTableViewController.swift:144:109: error: use of undeclared type 'SafeObject'
  2. RBQFetchedResultsController.framework/Headers/RLMObject+SafeObject.h:16:12: warning: duplicate definition of category 'SafeObject' on interface 'RLMObject'

The first issue looks like you need to add an import SafeRealmObject in ExaminationsTableViewController. The second issue looks like some duplicate headers are getting included somehow.

phatblat commented 7 years ago

I see what's going on here. Since this repo contains 2 distinct pods, you will need 2 Podfile entries to pull in both prerelease versions.

pod 'RealmSwift' pod 'RBQFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3' pod 'SwiftFetchedResultsController', git: 'https://github.com/phatblat/RBQFetchedResultsController.git', branch: 'swift-3' pod 'RBQSafeRealmObject' # not actually necessary now

Currently, you're getting the latest released version of RBQFetchedResultsController, which doesn't have the fixes.

syky27 commented 7 years ago

Ou yeah buddy this is first 'Build Succeeded' I see on this project for almost a month.

Good Work 🎉

syky27 commented 7 years ago

But, I am getting EXC_BAD_INSTRUCTION now.

in FetchedResultsController.swift screenshot 2016-11-13 00 29 22

And call stack looks like this:

screenshot 2016-11-13 00 30 17

phatblat commented 7 years ago

Yay, progress! 🎉

I'll look into that DelegateProxy init method. That may have been auto-inserted by the Swift 3 migration.

phatblat commented 7 years ago

I see what happened here. During migration the NS got stripped off of NSObject, the base class. However, now Object is being interpreted as the RealmSwift.Object class. The fit-its probably prompted me to add the missing required constructors for a Realm model object. As the Realm is initialized, this DelegateProxy is being created since it claims to be part of the schema.

syky27 commented 7 years ago

OMG, so much work...

Knowing that Swift 4 will not be compatible with swift3 I want to cry...

bigfish24 commented 7 years ago

Just tried out the branch and the Swift example which compiles but crashes at:

FetchedResultsController.swift:

/**
    Retrieve the Object for a given index path

    :warning: Returned object is not thread-safe.

    :param: indexPath the index path of the object

    :returns: Object
    */
    open func objectAtIndexPath(_ indexPath: IndexPath) -> T? {

        if let rlmObject = self.rbqFetchedResultsController.object(at: indexPath) {

            return unsafeBitCast(rlmObject, to: T.self)
        }

        return nil
    }

to fix:

/**
    Retrieve the Object for a given index path

    :warning: Returned object is not thread-safe.

    :param: indexPath the index path of the object

    :returns: Object
    */
    open func objectAtIndexPath(_ indexPath: IndexPath) -> T? {

        if let rlmObject = self.rbqFetchedResultsController.object(at: indexPath) {

            return unsafeBitCast(rlmObject as! RLMObjectBase, to: T.self)
        }

        return nil
    }
bigfish24 commented 7 years ago

Also RBQSafeRealmObject needs updated as well: https://github.com/Roobiq/RBQSafeRealmObject/issues/7

bigfish24 commented 7 years ago

RBQSafeRealmObject has been updated to 1.0.3: https://github.com/Roobiq/RBQSafeRealmObject/releases/tag/v1.0.3 (also pushed to Cocoapods)

phatblat commented 7 years ago

Thanks for the feedback! I'll see if I can fix these things up this weekend.

syky27 commented 7 years ago

How was your weekend?

phatblat commented 7 years ago

It's been busy lately, but this is ready for review again.

syky27 commented 7 years ago

So I ran my project and I got "Xcode auto correction "syntax" error" with the red dot with white circle inside, so I clicked it, and it autofilled this for me:

/**
     Notifies the delegate that a fetched object has been changed due to an add, remove, move, or update. Enables FetchedResultsController change tracking.

     Changes are reported with the following heuristics:

     On add and remove operations, only the added/removed object is reported. It’s assumed that all objects that come after the affected object are also moved, but these moves are not reported.

     A move is reported when the changed attribute on the object is one of the sort descriptors used in the fetch request. An update of the object is assumed in this case, but no separate update message is sent to the delegate.

     An update is reported when an object’s state changes, but the changed attributes aren’t part of the sort keys.

     :param: controller controller instance that noticed the change on its fetched objects
     :param: anObject changed object represented as a SafeObject for thread safety
     :param: indexPath indexPath of changed object (nil for inserts)
     :param: type indicates if the change was an insert, delete, move, or update
     :param: newIndexPath the destination path for inserted or moved objects, nil otherwise
     */
    public func controller<T : Object>(_ controller: FetchedResultsController<T>, didChangeObject anObject: SafeObject<T>, atIndexPath indexPath: IndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) {
        <#code#>
    }

My old protcol method implementation looked like this:

public func controller<T : Object>(_ controller: FetchedResultsController<T>, didChangeObject anObject: SafeObject<T>, atIndexPath indexPath: IndexPath, forChangeType type: NSFetchedResultsChangeType, newIndexPath: IndexPath) {
    }

I can see the change from Optional IndexPath to NonOptional, but I believe that the code documentation should to get pasted into my code :)

syky27 commented 7 years ago

And when I build and run the project I am getting SIGABRT in RealmConfiguration.swift:180

With following:

Could not cast value of type 'RBQSectionCacheObject' (0x10e01b560) to 'RealmSwift.Object' (0x10ea16390).

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 Realm 2.1.0

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.

ccheungfb commented 7 years ago

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.

generalpf commented 7 years ago

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.

phatblat commented 7 years ago

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.

syky27 commented 7 years ago

@phatblat see my last comment I am getting an error

phatblat commented 7 years ago

Ah, I'm getting the same error when running the "Swift" (no suffix) example project.

Could not cast value of type 'RBQSectionCacheObject' (0x1096e5a98) to 'RealmSwift.Object' (0x10a19e390).
phatblat commented 7 years ago

It's blowing up in toRLMConfiguration when retrieving configuration.objectTypes in order to copy over to rlmConfiguration.objectClasses. It's trying to cast RBQSectionCacheObject to RealmSwift.Object, but it is a subclass of RLMObject.

It looks like RealmSwift assumes that all objects that are part of the schema will be instances of RealmSwift.Object with no mix-and-match of the objc version of the framework. I hope this doesn't mean all the cache objects need to be reimplemented in Swift.