Can we integrate the code of swift in applications having deployment target less than iOS 7?
ios, objective-c, swift
Solution
Update - As per Xcode 6 Beta 4
iOS 7 and OS X 10.9 minimum deployment target
The Swift compiler and Xcode now enforce a minimum deployment target of iOS 7 or OS X Mavericks. Setting an earlier deployment target results in a build failure.
From Xcode 6 release note
So my previous answer(Shown below) will not be applicable to any further swift development. Swift will no longer available for iOS6 and below
Yes you can . I have tested a simple app written completely in `Swift` in my `iOS6 device`, it works perfectly fine. As apple says Swift code is binary compatible to ObjectiveC code. It uses the same compiler and runtime to create the binary.
So if you are not using any new APIs added as part of the iOS8 SDK or some swift specific api's (corresponding api is not available for ObjectiveC) your app will seamlessly work on iOS6+(Tested and working) even iOS5(not tested). Most of the APIs in the `swift` are just the replacement of the existing ObjectiveC api's. In fact they are same in binary.
Problem
As Swift supports the mix-match with objective c , then can we use it for building the applications having deployment target less than iOS 7. from Swift Prerelease Documentation Under the Basic Setup Section what i read is : ``` Swift is designed to provide seamless compatibility with Cocoa and Objective-C. You can use Objective-C APIs (ranging from system frameworksto your own custom code) in Swift, and you can use Swift APIsin Objective-C. This compatibility makes Swift an easy, convenient, and powerful tool to integrate into your Cocoa app development workflow. This guide covers three important aspects of this compatibility that you can use to your advantage when developing Cocoa apps: ● Interoperability lets you interface between Swift and Objective-C code, allowing you to use Swift classes in Objective-C and to take advantage of familiar Cocoa classes, patterns, and practices when writing Swift code. ● Mix and match allows you to create mixed-language apps containing both Swift and Objective-C files that can communicate with each other. ● Migration from existing Objective-C code to Swift is made easy with interoperability and mix and match, making it possible to replace parts of your Objective-C apps with the latest Swift features. ``` So after reading this the questions arrises in my mind are - Can we use swift for the applications we are currently working on. - If the answer is no then it will be contradict to the above explanation.