Sample Project Lister - Build Errors with Swift Version

I downloaded the sample Lister "Productivity App" (version 1.4, 2014-10-16) from Apple:

https://developer.apple.com/library/ios/samplecode/Lister/Introduction/Intro.html#//apple_ref/doc/uid/TP40014701

I have Xcode 6.0.1 running on OS X 10.10 (Yosemite). The Objective-C version works great. Swift version failed with error:

  • /Users/ben/Downloads/ListerAProductivityAppObj-CandSwift/Swift/ListerKit/ListDocument.swift:61:114: "List.Color" has no member named "rawValue"

  • /Users/ben/Downloads/ListerAProductivityAppObj-CandSwift/Swift/ListerKit/ListUtilities.swift:103:31: Bound value in conditional binding must be of optional type

  • /Users/ben/Downloads/ListerAProductivityAppObj-CandSwift/Swift/Common/List.swift:126:22: "List.Color" could not be constructed because it has no initializers available

  • /Users/ben/Downloads/ListerAProductivityAppObj-CandSwift/Swift/Common/List.swift:131:30: "List.Color" has no member named "rawValue"

Wondering why the sample project doesn't compile out of the box? The setting is performed in accordance with README.md

.

0


source to share


1 answer


The project is listed as requiring Xcode 6.1 or newer. Several things have changed, one of which is that the raw values ​​from enums are obtained using a property rawValue

, whereas in 6.0.x using a method toRaw()

.

Other errors are most likely caused by similar changes.



So, I suggest you download the latest 6.1 GM, which is still not available in the AppStore (although it is listed as "available soon"), so you need to manually download from the iOS / MacOS Dev Center

+1


source







All Articles