Do Xcode 8 Swift 3 Apps Run on iOS 7 Successfully

Swift 3 iOS compatibility

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

Is it possible to publish apps in Xcode 8/Swift 3 Beta for iOS 9?

https://developer.apple.com/support/beta-software/

Apps that are created using beta versions of Xcode or that are built for beta versions of an OS will not be accepted on the App Store.

Is it possible to use Xcode 7.x with devices running iOS 10 beta?

It is possible but only if you install Xcode 8 along side Xcode 7 (see below) and you connect the iOS 10 device to your computer while running Xcode 8. Once Xcode 8 downloads and processes the iOS 10 device, you will then be able to use the iOS 10 device on that same computer while using Xcode 7.

Rename /Applications/Xcode.app (your Xcode 7 installation) to something like /Applications/Xcode7.app. Then install Xcode 8. This way you can have both installed at the same time.

And you are correct that beta tools can't be used to build and submit to the App Store. Near the very end of the beta, Apple will post the GM version of Xcode and will send an email to developers that they are accepting iOS 10 apps. Using the GM version of Xcode 8 you will be able to submit your iOS 10 app.

Using Xcode 7 to develop apps for iOS 6 and iOS 7

After you create the project in your target settings you need to choose deployment target 6.0

Then in your build setting you need to make sure you choose correct architectures that supports 32 bits and 64 bit processor.

If you are going to use storyboards you need to make sure that you dont rely on Auto Layout feature because that is ios 7 and later versions.

Swift 2.0 minimum system version requirement (deployment target)

An Apple staffer had this to say:

iOS 7 / OS X 10.9, same as Swift 1.0.

Update: I'm guessing this is because the runtime is packaged into the built app / library / framework / whatever the same as with Swift 1.x.

create touch test apps on swift 4 or above

You can use collectionview for creating the layout. Use some color for default collectionview cell color. And when a collection view cell is selected you change change the color to clear color. When all cells are selected present the alert.

class ViewControllerNew: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {

let collectionView = CollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout())
var arr = [Int]()
var deletedArr = [Int]()
var rowCount = 0
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white

collectionView.backgroundColor = .white
collectionView.delegate = self
collectionView.dataSource = self
collectionView.translatesAutoresizingMaskIntoConstraints = false
collectionView.register(Cell1.self, forCellWithReuseIdentifier: "Cell1")
collectionView.isScrollEnabled = false
view.addSubview(collectionView)

collectionView.topAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.topAnchor).isActive = true
collectionView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor).isActive = true
collectionView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor).isActive = true
collectionView.bottomAnchor.constraint(equalTo: self.view.safeAreaLayoutGuide.bottomAnchor).isActive = true

if let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout {
let itemSpacing: CGFloat = 5
let itemsInOneRow: CGFloat = 5
layout.sectionInset = UIEdgeInsets(top: itemSpacing, left: itemSpacing, bottom: itemSpacing, right: itemSpacing)
layout.minimumInteritemSpacing = itemSpacing
layout.minimumLineSpacing = itemSpacing
let cellWidth = (UIScreen.main.bounds.width - (itemSpacing * 2) - ((itemsInOneRow - 1) * itemSpacing)) / itemsInOneRow
let rowCount = UIScreen.main.bounds.height / cellWidth
let newRowCount = Int((UIScreen.main.bounds.height - (itemSpacing * 2) - ((rowCount - 1) * itemSpacing)) / cellWidth)
layout.itemSize = CGSize(width: cellWidth, height: cellWidth)
self.arr = Array(0..<newRowCount*Int(itemsInOneRow))
collectionView.reloadData()
}
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return arr.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "Cell1", for: indexPath)
cell.backgroundColor = .red
cell.isUserInteractionEnabled = true
return cell
}
func updateCells(_ touches: Set<UITouch>) {
guard let location = touches.first?.location(in: collectionView),
let indexPath = collectionView.indexPathForItem(at: location),
let cell = collectionView.cellForItem(at: indexPath) else {
return
}
cell.backgroundColor = .clear
if !deletedArr.contains(indexPath.item) {
deletedArr.append(indexPath.item)
}
if deletedArr.count == arr.count {
let alert = UIAlertController(title: "Game Finished", message: nil, preferredStyle: .alert)
let okBtn = UIAlertAction(title: "Ok", style: .default) { action in
self.deletedArr.removeAll()
self.collectionView.reloadData()
}
alert.addAction(okBtn)
self.present(alert, animated: true, completion: nil)
}
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
updateCells(touches)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
updateCells(touches)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
updateCells(touches)
}
}
class Cell1: UICollectionViewCell {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
return nil
}
}
class CollectionView: UICollectionView {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
return nil
}
}

Sample Image



Related Topics



Leave a reply



Submit