I have recently updated to Xcode 8. Previously I was using Xcode 7 with Swift 2.2.
I have a framework that I built in with deployment target iOS 9.3. Now that I have moved to Xcode 8 I cannot use this framework.
Is there a way I can build a framework that will work for iOS sdks 8 and above?
I want to set the minimum deployment target of my app to iOS 8+.
Also
Alamofire for Swift 3 has been updated and I have updated my pod file.
Will I be able to run the app in iOS versions above 8?
Any help will be appreciated.
Yes it is possible to build frameworks for iOS 8 with Xcode 8. But if you try to support iOS 8 you could also use Swift 3, put If you use other frameworks like Alamofire, you have to be careful, because the latest version of Alamofire (4.x) requires a minimum iOS target version of iOS 9. So you have to use Alamofire (3.x). With Alamofire 3.5 you have to use Swift 2.3
So first you have to decide what's more important for you:
iOS 8 support: So you have to switch to Swift 2.3 and Alamofire 3.x
Swift 3 support: So you have to drop iOS 8 support, because Alamofire 4.x requires iOS 9
As you know that Xcode 8 supports only Swift 2.2 and Swift 3. Your framework is built on top of Swift 2.2. So there is no way that you can run or build the project in Xcode 8, you will get an error like "The project has an older version of Swift, Please build it with newer version of Xcode".
You can use Xcode 8 and you can set minimum deployment target to iOS 8. But you can't use any of the new Swift 3 features in there, I mean you can use it but it will not execute in iOS 8. For that you have to write code with class or API availability checking for each snippet you write.
If you use new version of Alamofire there is no chance that you can use it in iOS 8.0. You need an older version of it. Because Alamofire new version is Swift 3 and have minimum deployment target of iOS 10 I think.
So it is better to convert your project into Swift 3 or to Swift 2.3. That is the best way to solve this situation. Otherwise you will see more lot of problems eventually.
Related
I am following this tutorial and am trying to get the starter project to run. When I open the project, I see these warnings:
Unsupported Swift Version
The target “SocketChat” contains source code developed with Swift 2.x. Xcode 9 does not support building or migrating Swift 2.x targets.
Use Xcode 8.x to migrate the code to Swift 3.
On running this program stops executions and I get this error
Dependency Analysis Error Group
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
I am using Xcode 9 beta. How can I resolve this issue and get the project running?
Your project possibly has swift 2.0, swift 2.1 or swift 2.2 version so Xcode 9 or later does not support that versions. and neither it can convert the swift 2.x's syntax to swift 4
Remember that xcode 9 or later has swift 4 version by default.
Open this project in Xcode 8 8.1, 8.2, or 8.3 your project will run successfully.
I have a conclution and since I am a beginner, I just want to get it confirmed by someone else.
In my iOS app (Swift 2.2, Xcode 7) that must support iOS 8, I use Alamofire for server communication. Now my conclusion is that I will not be able to migrate the app to Xcode 8 and Swift 2.3 or 3.0, since I then have to use Alamofire version 4 and that version doesn´t suport iOS 8. So my app has to keep Alamofire version 3 which means that it has to stay Swift 2.2 and Xcode 7. Did i understand this correctly?
Alamofire 4 requirements:
https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md
Alamofire 3 requirements:
https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md
No you can't Alamofire 4.0 requirements:
iOS and tvOS 9.0+, macOS 10.11.0+, watchOS 2.0+
Xcode 8.0+
Swift 3.0+
If you would like to use Alamofire on iOS 8 or macOS 10.9, use the latest tagged 3.x release which supports both Swift 2.2 and 2.3.
Reference
Alamofire 4.0 Migration Guide said,
If you would like to use Alamofire on iOS 8 or macOS 10.9, use the
latest tagged 3.x release which supports both Swift 2.2 and 2.3.
So, if you want to update to Xcode 8, you can convert your project to Swift 2.3 and use Alamofire 3.5.0. This release supports Swift 2.3 and iOS 8+.
Try my fork, https://github.com/tonyli508/AlamofireDomain, I pull the latest changes and disabled stream request feature, which targeting IOS 8.
I'm new to Apple developing and soon I will distribute my app via AppStore. So now I'm using Swift 3 and by default the deployment target is set to iOS 10.0 It means that I won't be able to make it run for example on iOS 8-9? 'Cos in Swift 3 I use new funcs which are not available in later OS
You can make your app run on iOS 8 & 9 by setting the Deployment Target to one of these versions. Swift 3.x is compatible with iOS 8 and newer (I'm not sure, but it might be also compatible with iOS 7). The only difference to Swift 2.2 (regarding the system requirements) is that you have to use Xcode 8.
When you set your Deployment Target to an earlier version than iOS 10, you should be aware that you cannot use APIs that are new in iOS 10. (except you use the #available operator) But using Swift 3 should be no problem.
Edit: You can now upload apps written in Swift 3 using Xcode 8.0 GM
You should use Swift 3.x (it's the latest version of Swift since this answer has been posted).
iOS version is NOT related to the Swift version you should use, instead, some of the new provided apis do support a minimum version of the OS. But -again- it's not related to the programming language it self. For example: an application has been built via Swift 2.x (Deployment Target 9.x) should work on iOS 10; When updating the IDE (xcode), it will support -by default- the latest version of the programming language -Swift-.
Also, You could do:
if #available(iOS 10, *) {
// use an api that requires the minimum version to be 10
} else {
// use another api
}
I am developing a swift framework (in xcode 6 - swift 1.2) and recently updated to xcode 7
Xcode 7 introduce swift 2.0 and when trying to use my framework on apps being developed on xcode 7 i get errors on using prior version of xcode
I need to maintain the framework also for the use of developers using xcode 6
Is there a way to build a framework on xcode 7 as if it is build in xcode 6?
No, there is no way to build framework on Xcode 7 as if it was Xcode 6. Either continue your development using Xcode 6, or upgrade to 7 and release a new version of your framework that requires 7.
I have a project that I've been working on with my friend on Swift 1.1/1.2.
Unfortunately, when I upgraded my Xcode to the latest version, I noticed that the app will no longer compile and there are lots of errors.
Is there a way for Xcode 7 to compile for Swift 1.2?
If not, how do I get the old version of Xcode which does not use Swift 2?
Is Swift 2 app backward compatible with Swift 1 apps?
Can Swift 1.2 app run on iOS 9?
Are most developers using the Swift 2 now or not?
In Xcode start with Edit->Convert->To Latest Swift Syntax...
You may still have errors that you will have to resolve manually. Read the Xcode Release Notes to see what changed in Swift 2.