I’m learning Swift, and found a Github project converting the ToDoLite app to Swift. Only thing is it was done for Beta 4 of Swift, so code is quite out of date. I spent some time this evening fixing loads of compiler errors but left with two that I can’t figure out:
self = [super initWithDocument:doc]; // No visible @interface for 'CBLModel' declares the selector 'initWithNewDocumentInDatabase:'link self = [super initWithNewDocumentInDatabase: database]; //No visible @interface for 'CBLModel' declares the selector 'initWithDocument:'link
I see in the docs that those init methods should exist, or are the docs out of date?
As James says, we had to make an incompatible change in the API to fix some problems. You’re not the first to be confused.
Remember that the framework headers are available as documentation too, and are (by definition) accurate. They even contain doc-comments for every entity. Command-clicking an identifier will take you to the header defining it, and in Xcode 6 you can also option-click to see the documentation in a pop-up.
Thanks guys, I ended up looking at the up to date iOS ToDoLite example which showed me which methods to use. Obviously the example project I’m looking at was written a while ago and has not been updated for CBL 1.1. And yes of course looking at header files is always a sure way to see what methods are available. Sorry for the late response on this.
Are there any plans to create a Swift version of the latest ToDoLite example? I’ve hit an issue with my version which causes it to crash on loading the detail view (due to a nil UITextField, posted on StackOverflow)
Would be useful for those of us wishing to see a full fledged working example of CBLite in Swift.
Also, I posted a comment on SO: “Set breakpoints at the start of configureView and viewDidLoad and see which one is called first. It sounds like configureView gets called first. You’d need to fix the calling code to not call it so early.”