iOS 11 App Development: How to Build iOS App Compatible With iOS 11?

0
Shares
iOS 11 App Development: How to Build iOS App Compatible With iOS 11?
5 (100%) 3 votes

build ios app compatible with ios 11

Another WWDC keynote has come and gone, and iOS 11 was the least surprising announcement of WWDC 2017. Though there is no doubt that it is the most advanced mobile OS, but unfortunately the 32 bit iOS apps will no longer be supported in the new iOS update. So, in order to help you with your iOS app development, here’s list of things that you need to consider to build iOS app compatible with iOS 11.

Let’s Get Started

Now, the final version of iOS 11 won’t be available till September, but you can get a better chance of being featured in the Apple App Store by building your iOS app compatible with iOS 11.

New Navigation Bar That Highlights Your Titles

There are many subtle design changes in iOS 11. For example, the iOS 7 update was all about minimalistic and thinness, but the iOS 11 is completely opposite. It’s big and bold. So, in iOS 11 we’ll see a decreased information density, big navigation bar header like below image, and bolder typography everywhere.

build ios app compatible with ios 11

To implement large title on your App’s navigation bar, include following code:

navigationController?.navigationBar.prefersLargeTitles = true

If you don’t want large title in a particular screen, then use following code:

navigationItem.largeTitleDisplayMode = .never

Drag & Drop. Now on iOS.

build ios app compatible with ios 11

It is a newly added feature in new iOS 11 update. The Drag & Drop feature moves almost everything from one app to another, and it has been mainly designed for large and multi touch screens (iPads).

So, by adding this feature in your iOS 11 app, users can easily drag items from your app to other apps. For example, users can copy a text or pick an image and drag it to a social media app such as Facebook to directly post it on their timeline.

To implement it in your iOS app, first you need to set the following delegates:

tableView.dragDelegate = self

Now, to lift and drag one item of UITableView in your iOS app, use following code:

func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
let image = arrImg[indexPath.row]
let provider = NSItemProvider(object: image as NSItemProviderWriting)
let item = UIDragItem(itemProvider: provider)
item.localObject = image
return [item]
}

This method will allow you to lift only one item at a time.

To lift and drag multiple items of UITableView, use following code:

func tableView(_ tableView: UITableView, itemsForAddingTo session: UIDragSession, at indexPath: IndexPath, point: CGPoint) -> [UIDragItem] {
let image = arrImg[indexPath.row]
let provider = NSItemProvider(object: image as NSItemProviderWriting)
let item = UIDragItem(itemProvider: provider)
item.localObject = image
return [item]
}

This method will allow you to lift multiple items at a time.

Next, to drop lifted item(s), first you’ll need to set its delegate.

TableView.dropDelegate = self

Now, to check whether drop items can be handled or not, use following code:

func tableView(_ tableView: UITableView, canHandle session: UIDropSession) -> Bool {
return session.canLoadObjects(ofClass: UIImage.self)
}

This method will check tableview and whether it can handle drop or not.

Then, if you’d also like to add a drop animation and operations, use following code:

func tableView(_ tableView: UITableView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UITableViewDropProposal {
return UITableViewDropProposal(dropOperation: .copy, intent: .automatic)
}

This method will help you add animation when you drop an item.

To drop items in a particular indexpath, use following code:

func tableView(_ tableView: UITableView, performDropWith coordinator: UITableViewDropCoordinator) {
var destinationIndexPath: IndexPath!

if let indexPath = coordinator.destinationIndexPath {
destinationIndexPath = indexPath
} else {
let section = tableView.numberOfSections - 1
let row = tableView.numberOfRows(inSection: section)
destinationIndexPath = IndexPath(row: row, section: section)
}

coordinator.session.loadObjects(ofClass: UIImage.self) { items in
guard let pickedImages = items as? [UIImage] else { return }

var indexPaths = [IndexPath]()

for (index, image) in pickedImages.enumerated() {
let indexPath = IndexPath(row: destinationIndexPath.row + index, section: destinationIndexPath.section)

This method will help you drop multiple items in a particular indexpath.

Swipe Actions For Better Interactions

how-to-build-ios-app-compatible-with-ios-11-swipe-actions

Swiping is a natural interaction in mobile apps for moving items around. In iOS 11, Apple has provided an enhanced Swipe actions feature to create an iOS app compatible with iOS 11.

To implement swipe to left feature, use following code:

func tableView(_ tableView: UITableView, leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let action = UIContextualAction(style: .normal, title: "Archive") { (action, view, bool) in
print("Archive Tapped")
bool(true)
}
action.image = //Add your specific Image
action.backgroundColor = //Change the Background Color
let configuration = UISwipeActionsConfiguration(actions: [action])
return configuration
}

This method will help you add swipe to left feature in your iOS app.

To implement swipe to right feature, use following code:

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let action = UIContextualAction(style: .destructive, title: "Delete") { (action, view, bool) in
print("Delete Tapped")
bool(false)
}
action.image = //Add your specific Image
let configuration = UISwipeActionsConfiguration(actions: [action])
return configuration
}

This method will help you add a swipe to right feature in your iOS app.

Search Controller

build ios app compatible with ios 11

In addition to large title in the Navigation bar, the new iOS 11 update also offers support for SearchController.

To implement SearchController in your iOS app, use following code:

self.navigationItem.searchController = searchController

And done!

If you need any help with the above code, or looking for a top iPhone app development company for iOS App Development, contact us.

 
0
Shares
 

LET'S TALK VALIDATE YOUR IDEA!