All,
[apologies if this is not the right forum - there's a few places it could have gone]
We've written a swift app for OSX (swift 2.2, couchbaselite syncing to cloud servers, all works fine) and need to port it to iOS. We are in the process of moving as much code into cross platform frameworks as we could - encryption, common utilities, models. Then we can start on the UI.
The projects (for each framework) were created using instructions from here - each has two targets, one for iOS, one for OSX.
The encryption and common utils are fine - we have builds working in iOS and OSX. But the models framework goes a little awry. For some reason, we've started getting some weird errors such as follows:
Compiling the OSX target:
- Use of undeclared type 'NSDocumentTypeDocumentAttribute'
- Value of type 'NSAttributedString' has no member 'dataFromRange'
This code used to work when it was all a big OSX app. And docs for Mac and iOS versions of NSAttributedString definately list dataFromRange and NSDocumentTypeDocumentAttribute. When I type "NSAttributedString(", auto-completion now only offers me a very few completions, and it doesn't include dataFromRange. Is there some target setting I've messed up which reduces NSAttributedString?
Each source file in the project is associated with both build targets (iOS, macOS).
Further, on another line with the NSDocumentTypeDocumentAttribute replaced by "DocumentType":
astr = try NSAttributedString(data: data,
options: ["DocumentType":gDocumentSaveFormat],
documentAttributes: nil)gets the error:
- Type of expression is ambiguous without more context
Another error I see is in the iOS build (I dont see further errors becuase this stops compilation very early):
- No such module "CouchbaseLite"
This one is weird because CouchbaseLite is definately included in the Target's "Linked Frameworks and Libraries" and appears in Build Phases | Link Binaries With Libraries for both iOS and macOS. It doesn't happen on macOS.
I'd appreciate any ideas you have on this, and any resources on cross platform frameworks you can point me at.
Cheers.
Paul