How to import and use CreateML or CreateMLUI in Xcode - swift

I would like to use the new CreateML and CreateMLUI Swift frameworks.
But when I write:
import CreateML
Xcode gives me an error:
No such module 'CreateML'
How can I use those in Xcode?

To import CoreML or CoreMLUI you need to get latest software:
Go to https://developer.apple.com/download/
Install macOS Mojave 10.14 beta version.
Install Xcode 10 beta.
Create a macOS platform template.
HOW TO CREATE YOUR OWN MLMODEL: https://developer.apple.com/documentation/create_ml/creating_an_image_classifier_model
Use free MLModels provided by apple: https://developer.apple.com/machine-learning/run-a-model/

You need to
Have Mojave installed
Install Xcode 10 beta
Create a macOS template playground (not iOS)

Install Mojave* and Xcode 10.
Create a new playground and make sure you select macOS as the target (e.g. macOS Single View).
Type in import CreateMLUI- it should compile without problems.
(*)macOS Mojave is officially available since yesterday.

For Xcode 10 - beta 6
You don't have to upgrade to Mojave. The newest Xcode - beta already supports 10.13.x. (From Apple Developer Forums).
I followed this step to try CreateML framework.
Upgraded to latest MacOS (Not Mojave)
Upgraded latest Xcode - beta.
Create playground in macOS template (Default is iOS template)
Then, I can use createMLUI.

Related

Swift Version Conflict: this SDK is not supported by the compiler, Please select a toolchain which matches the SDK

I'm using xCode 13.1 with macOS 12.0.1 Monterey. I added KingFisher and removed it from my pod. but my project is not built anymore. I got this error for one of my local SDKs:
Failed to build module 'CbSdk';
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.4
(swiftlang-1205.0.26.9 clang-1205.0.19.55)', while this compiler is 'Apple Swift version 5.5.1
(swiftlang-1300.0.31.4 clang-1300.0.29.6)'). Please select a toolchain which matches the SDK.
What I've done but didn't work:
pod deintegrate and pod install.
restart xCode with clearing cache and DerivedData.
checkout old branch and commit that worked before.
moving code to another macBook that worked before.
download, install and select toolchain 5.4 (odd errors appeared -> )
changing swift compiler language of my target and project to swift 4 (It says you are using swift 5.5.1 again!)
note that I didn't update xcode or swift!
Taken from this Twitter thread.
You need to set the BUILD_LIBRARY_FOR_DISTRIBUTION build setting on the framework target
https://www.swift.org/blog/library-evolution/
https://developer.apple.com/videos/play/wwdc2019/416/
I fetch the same problem when I try to update a library. My Xcode version was 13.2 with the swift version5.5.2. But the library I want to update required a swift version of 5.7.0. Using toolchains in Xcode might be the solution but I decided to update the Xcode version with the latest.
I update my Xcode to the latest version 14.1 and the issue is resolved. Automatically the swift version is found on the latest Xcode.

Unable to load standard library for target arm64 error in XCode on Macbook Air M1

On new Mac with M1 chip get the error after the build of React Native app in XCode 12.4:
unable to load standard library for target 'arm64-apple-ios8.0'
failed to build module 'SciChart' from its module interface; the compiler that produced it, 'Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)'
What I already tried:
Reinstall XCode;
Changed Swift Language Version;
Deleted VALID_ARCHS reference according Xcode 12 Beta 2 - unable to load standard library for target 'arm64-apple-ios14.0-simulator'
On Macbook with intel chip there are no errors with the same app. And both of my Macbook have the same swift version:
Apple Swift version 5.3.2 (swiftlang-1200.0.45 clang-1200.0.32.28)
Target: x86_64-apple-darwin20.3.0
Can you help me please!
Guys if you have old React Native projects just build it on Xcode with rosetta and you will save your nerves and time. I was looking the decision all week, but in the total it was so easy, just run Xcode with rosetta on M1: please try to open Xcode through Rosetta - Right click on Xcode in applications folder -> Get Info -> set Open with Rosetta to true

The document “Main.storyboard” requires at least Xcode 12.0

I am working on Xcode 12. And I created a new project on Xcode 12. I compile & run it successfully. when I run this project on Xcode 11.3 then It throws an error like: The document “Main.storyboard” requires at least Xcode 12.0 .
So, help me to fix this problem. I want to run this project in a lower version of Xcode 12.
Since the project is created in Xcode 12. The minimum required Xcode version is Xcode 12. If you want to compile with Xcode 11.3, recreate the main.storyboard using Xcode 11.3
Edit:
As pointed out my matt in a comment alternative way is to open main.storyboard as source code and update toolversion value same as Xcode 11.3. (try sample storyboard to find toolversion for Xcode 11.3)

Failed to build IONIC Geofence on Xcode

I am using Geofence plugin on IONIC. When I build on Xcode 10.2 it's say:
"Unsupported Swift Version. The target 'MyApp' contains source code developed with Swift 3.x. This version of Xcode does not support building or migrating Swift 3.x targets. Use Xcode 10.1 to migrate the code to Swift 4"
But if I downgrade to Xcode 10.1, it will not work on iOS 12.2.
What should I do now?

Trouble getting Vapor to work with Xcode 8 beta 3

I was following the instructions here, but was not able to get vapor working on my mac. Here're my xcode and swift versions
Xcode 8.0
Build version 8S174q
Apple Swift version 3.0-dev (LLVM 8fcf602916, Clang cf0a734990, Swift 000d413a62)
Target: x86_64-apple-macosx10.9
When I try to install the toolbox using this command
curl -sL toolbox.qutheory.io | bash
The installation is unsuccessful and yields this message
⚠️ It looks like your Command Line Tools version is incorrect.
Make sure Xcode > Preferences > Locations > Command Line Tools is set correctly.
Correct: Xcode 8.0 (8S162m)
Current: Xcode 8.0
Build version 8S174q
⚠️ It looks like your Swift install location has been modified.
Correct: /usr/bin/swift
Current: /Users/<name>/.swiftenv/shims/swift
❌ Incompatible
Reason: Invalid Swift version
Output must contain 'swiftlang-800.0.33.1'
Current 'swift -version' output:
Apple Swift version 3.0-dev (LLVM 8fcf602916, Clang cf0a734990, Swift 000d413a62) Target: x86_64-apple-macosx10.9
📖 Visit our docs for step-by-step instructions on installing Swift correctly.
http://docs.qutheory.io
👋 or Join our Slack and we'll help you get setup.
http://slack.qutheory.io
From this, I can gather that my swift location is wrong (I don't remember changing it) and that my xcode build number is wrong (because xcode beta 2 is no longer available for download, so I got xcode beta 3.)
Can anybody help me to get this working without changing too much, or is this framework still too finicky to work with a slightly different setup?
Unfortunately it's impossible to create packages that work between different Swift 3 development previews because of how much changes in each preview. Things that compiled today might not compile tomorrow and there is no way to selectively target a given preview in code.
Because of this, the Swift version declared in https://github.com/qutheory/vapor#-current-environment for a given Vapor version must be the one used.
Vapor 0.14 relied on the Swift 3.0 preview 2 version that comes with Xcode 8 beta 2. There is currently no way to download Xcode 8 beta 2 now that Apple has stopped hosting it upon the release of Xcode 8 beta 3. That was an oversight.
Vapor 0.15 will not rely on Xcode 8 beta previews and should be released in a few days.
Open Xcode and make sure the correct SDK is selected:
👀 Xcode > Preferences > Locations > Command Line Tools
Select XCode 8
Then continue with the tutorial you are following.