I am using Ray Wenderlich's Storyboard tutorial part 1 to learn how to use storyboards, and I'm doing it in Swift. So I'm transferring the following code, which is located in the AppDelegate.swift file, from
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UINavigationController *navigationController = [tabBarController viewControllers][0];
PlayersViewController *playersViewController = [navigationController viewControllers][0];
playersViewController.players = _players;
to
let tabBarController : UITabBarController = self.window?.rootViewController as UITabBarController
let navBarController = tabBarController.viewControllers[0] as UINavigationController
let playersController = navBarController.viewControllers[0]
playersController.players = self.players
However, the latter section of code throws a compiler error because when I declare playersController I'm not downcasting the AnyObject that is returned by navBarController.viewControllers[0] to my custom PlayersTableViewController class. So I do that with the following code
let playersController = navBarController.viewControllers[0] as PlayersTableViewController
But this causes the SourceKitService Xcode 6 bug to be appear, and I lose all syntax highlighting.
So I'm left with either continuing with no syntax highlighting, or not continue at all because playersController needs to be recognized as a PlayersTableViewController in order to access the players property. I've narrowed it down to that downcast operation that causes Xcode to bug out, does anyone have any solutions to this problem?
EDIT: I tried to go ahead without syntax coloring, write the necessary code, and then compile it, but it threw the following messy compiler error.
0 swift 0x0000000109fed688 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x0000000109fedb74 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff8f55b5aa _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1890208368
4 swift 0x00000001094b8dab (anonymous namespace)::RValueEmitter::emitForceValue(swift::SILLocation, swift::Expr*, unsigned int, swift::Lowering::SGFContext) + 1291
5 swift 0x00000001094ace5f swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 4111
6 swift 0x00000001094b436d swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 45
7 swift 0x00000001094cb903 swift::Lowering::SILGenFunction::emitRValueAsOrig(swift::Expr*, swift::Lowering::AbstractionPattern, swift::Lowering::TypeLowering const&, swift::Lowering::SGFContext) + 179
8 swift 0x000000010949f496 (anonymous namespace)::CheckedCastEmitter::emitOperand(swift::Expr*) + 150
9 swift 0x00000001094b6350 emitUnconditionalCheckedCast(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Expr*, swift::Type, swift::CheckedCastKind, swift::Lowering::SGFContext) + 288
10 swift 0x00000001094ae40d swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 9661
11 swift 0x000000010949caeb swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*) + 219
12 swift 0x000000010949397e swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 190
13 swift 0x00000001094cfd4c swift::Lowering::SILGenFunction::visitBraceStmt(swift::BraceStmt*) + 332
14 swift 0x00000001094d2c54 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Stmt*) + 148
15 swift 0x00000001094a0f93 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 243
16 swift 0x0000000109482096 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 230
17 swift 0x000000010949bd83 swift::ASTVisitor<SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 355
18 swift 0x000000010949a70b SILGenType::emitType() + 203
19 swift 0x00000001094956de swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
20 swift 0x000000010948400b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 411
21 swift 0x000000010948428c swift::SILModule::constructSIL(swift::Module*, swift::SourceFile*, unsigned int) + 268
22 swift 0x0000000109484390 swift::performSILGeneration(swift::SourceFile&, unsigned int) + 32
23 swift 0x00000001093751a7 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 3255
24 swift 0x000000010937448d main + 1645
25 libdyld.dylib 0x00007fff9a2fd5fd start + 1
26 libdyld.dylib 0x0000000000000039 start + 1708141117
Stack dump:
0. Program arguments: /Applications/Xcode6-Beta4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/Player.swift /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/ViewController.swift -primary-file /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/AppDelegate.swift /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/PlayersTableViewController.swift -enable-objc-attr-requires-objc-module -target i386-apple-ios7.1 -module-name Ratings -sdk /Applications/Xcode6-Beta4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.0.sdk -I /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Products/Debug-iphonesimulator -F /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Products/Debug-iphonesimulator -g -module-cache-path /Users/alex/Library/Developer/Xcode/DerivedData/ModuleCache -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-generated-files.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-own-target-headers.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-all-target-headers.hmap -Xcc -iquote -Xcc /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Ratings-project-headers.hmap -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Products/Debug-iphonesimulator/include -Xcc -I/Applications/Xcode6-Beta4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/DerivedSources/i386 -Xcc -I/Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate~partial.swiftdoc -O0 -emit-module-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate~partial.swiftmodule -serialize-diagnostics-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate.dia -emit-dependencies-path /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate.d -o /Users/alex/Library/Developer/Xcode/DerivedData/Ratings-cylggjacqbkxbeeotoghnkluxwly/Build/Intermediates/Ratings.build/Debug-iphonesimulator/Ratings.build/Objects-normal/i386/AppDelegate.o
1. While emitting SIL for 'application' at /Users/alex/Desktop/CodingFolder/iOS/Ratings/Ratings/AppDelegate.swift:18:5
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)
Command /Applications/Xcode6-Beta4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift failed with exit code 254