xcode 8 doesn't support indexPathsForVisibleRows in iOS 8 - ios

I have a project and use a lot of indexPathsForVisibleRows. Our project support iOS 8.0+ users. We migrate from Xcode7 to Xcode8 recently and find that Xcode 8 just support indexPathsForVisibleRows for only iOS9.0+ which doesn't work on iOS8. That is a disaster. Could anyone can help me?

For Objective-C and Swift 2.3 & under, the indexPathsForVisibleRows property is still marked as working from iOS 2.0 (a.k.a. the beginning) & onwards.
If you're using Swift 3 (which comes with Xcode 8), then you'll be limited to iOS 9 & newer (as the documentation states here).
If this were my problem I would probably choose to write some kind of helper function / class method in Objective-C via a bridging header solely for this issue.

Related

How can I determine whether a property or function in Swift 3 is available for iOS 8

For example, in swift 3 there is a new type and property: Calendar.current, does it support for iOS 8?
The document said the SDK is iOS 10+, but I can run a app using this type property on iOS 8 device. This is very strange.
I want to know is there any place to check the minimum iOS version support for a type, property and function?
Or may be just the document is not updated? I use Xcode 8 GM version.
The Swift Syntax that is available is dependant on the development environment (The version of Xcode), not the iOS platform that Xcode is building for. Therefore swift 3.0 syntax will be valid for any project for any iOS version that is built using Xcode 8+ (assuming you have not enabled the setting to use legacy swift, which uses the older syntax)
As #Eric Aya said, just because it's new for Swift 3 doesn't mean that it won't work on earlier versions of iOS.
This is (somewhat) equivalent to the change of CGRectMake() to CGRect(). You can't use CGRectMake() in Swift 3, but its replacement will work for pre iOS 10 (how else would you do it?).
Swift 3 will work for any project being made in Xcode 8 (unless you specifically choose Swift 2). It does not take into account which version of iOS or which device.
You can read more at the official Swift 3 migration guide.

Xcode 7 is out. What about submission with Xcode 6 and swift 1.2?

I have an application in review and it has been implemented with swift 1.2 and Xcode 6.x. In case Apple rejects my build I've to do the required fixes and submit it again. I've started working on the port to swift 2 but some of the libraries that I use have not been updated or they have dropped support for iOS 7 updating to swift 2.0... bad situation. That said, probably it takes some days (hopefully) to get back to a completely working project.
1) in the meanwhile can I still compile my current code with Xcode 6 swift/1.2 ? does Apple accept this kind of submission or they requires a build created with Xcode 7.
2) Can I avoid switching to swift 2.0 and use anyway XCode 7?
You can still use Xcode 6 and Swift 1.2. Apple will eventually require the newer tools but the now older one is still fine.
Of course you can't take advantage of any iOS 9 features this way but at least make sure your app works under iOS 9.

Sticking with Swift 1 and making app for IOS7 and above

I have few questions that I was considering while making an app. The app supports ios7 and above. Its being written in swift 1.2 and I came across few articles that it's better to switch the code to Swift 2. The problem is some frameworks that is being used does not support swift 2 just yet.
1) Is it possible to stick with swift 1.2 and continue deploying for iOS 7 and above?
2) Once Xcode 7 is official, do we need to update all the code to Swift 2 or can continue with Swift 1.2 for some time until all the frameworks upgraded to Swift 2.
Thank you
1) You don't have to switch to Swift 2 immediately, but you have to stick with Xcode 6 and there's some inconvenience such as not being able to test on iOS9.
2) It's easy to upgrade Swift 1.2 code to Swift 2, my opinion is to wait until the frameworks support Swift 2.
Good luck!

swift will I be forced to remake my app's code when swift 2.0 is released

I have made an app using swift 1.2.
Will I be forced to rebuild my entire using swift 2 when its released?
Or can I still make updates to my app using swift 1.2 code?
It's my understanding that Xcode 7 uses Swift 2, and Xcode 6.x uses Swift 1.2.
Apple will probably continue to support Xcode 6.x for some time after Xcode 7 goes GM. During that time you should be able to support your Swift 1.2 code. However, it's not a good idea to depend on old developer tools. You should think about migrating to Swift 2 once Xcode 7 is released.
When i used xcode 7.beta 4, i converted my code for swift 2. when i ran the same code with xcode 7.beta 5, again i ran into few more swift related errors. better keep calm until Apple releases the final xcode version which supports swift 2+

Can we integrate the code of swift in applications having deployment target less than iOS 7?

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.
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.
I am not sure but YES swift support lower version of ios in to Xcode Beta if you are check in to Project-->Target-->General-->Deplyment Info for select deployment target there is drop-down with 6.0,6.1,7.0,7.1 and 8.0
So i think yes swift support lower version.
I just test the demo that created in Xcode6 with swift language select. then i open this project in to Xcode5 with deployment target 6 and that runs it means that working with lower version too.
Here it is a screenshot of swift project runs in xcode5 with ios6.1 simulator:
HERE IT IS DEMO AS WELL http://www.filedropper.com/demo_5
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.
No, only iOS 7+ and OS X 10.9+.
You can import and run swift code from Objective-C like this:
#import “ProductModuleName-Swift.h”
MySwiftClass *swiftObject = [[MySwiftClass alloc] init];
[swiftObject swiftMethod];
You can check the iOS version number with this gist and only run the swift code if the version is >= 7.0.
Yes, the minimum deployment target for Xcode 6 with Swift language is iOS 6.0
Yes you can. Its not important in which language you are writing the code. Finally what matters is compiler and architecture. So, you should definitely able to deploy them to OS version less than 7.0

Resources