Things to Keep in Mind for iOS 11 App Development – Part 2

Overview

In Part 2 of my Blog, you will learn more about some new features released in WWDC 2017 for iOS where I will cover topics like how to use and implement search controller within navigation bar and what’s new in Swift 4 (Swift 4 is in beta so still there’s a lot to come). To learn about Drag and Drop, Swipes Actions and other updates, please refer my previous blog Things to Keep in Mind for iOS 11 App Development – Part 1

Search Controller

Navigation bar now also provides support for searchController.

ios11-search controller

How to implement in your application?

– Declare Variable.

– In viewDidLoad.

What’s new in Swift 4?

Multiline String

  • In previous versions of swift, if you want to move text to a new line developer needs to add `\n’ to break line but now it is no more needed.
  • Now developer can write multiple lines of string by using “”” (three double quotation). Write whole string between “”” and you have your string with multiple lines without using “\n”.

Implementation

Output
MultiLineString: –
Yudiz refers to the spirit of youth.
The Google ranking recognizes us as a top mobile app development company, globally.
Example of “Double Quotes” without any escaping.

String Character

  • Until now, if you want to perform string manipulation, we wrote string.characters.xxx. But now it’s no longer required.

Implementation

Output
Individual Character: –
H
e
l
l
o
W
o
r
l
d
!

Swap Array Elements

  • There is a small change that I think you must be aware of it, as you will need this in your app at any point.
  • Swap function takes the two indexes which are to be swapped.

Implementation

Output
Swap: –
[“Kevin”, “Vishal”, “Nishal”, “Ravi”, “Chirag”, “Shivam”, “Mahavir”]

One Side Range

  • Side Range returns number of elements (based on your condition) from array without using loop.

Implementation

Output
Less than: –
[“Kevin”, “Nishal”, “Vishal”]
Greater than: –
[“Ravi”, “Chirag”, “Shivam”, “Mahavir”]

Create Dictionary using single array

Implementation

Output
Created Dictionary: –
[2: “Nishal”, 4: “Ravi”, 5: “Chirag”, 6: “Shivam”, 7: “Mahavir”, 3: “Vishal”, 1: “Kevin”]

Grouping elements of array with key

  • Now grouping dictionary is easier than ever.
  • This feature will be very useful for ‘contacts’ type of app.

Implementation

Output
Group Name: –
[“V”: [“Vishal”, “Vipul”],
“N”: [“Nishal”],
“C”: [“Chirag”],
“R”: [“Ravi”],
“K”: [“Kevin”, “Krishna”],
“M”: [“Mahavir”],
“S”: [“Shivam”]]

JSON Encoder and Decoder

  • One of the best feature in Swift 4.
  • In order to use this feature, custom class/struct/enum must be Codable.
  • You can customize behaviour if required.

Implementation

Output
Json Encoded Data: –
{
“name”:”Kevin”,
“address”:{
“state”:”Gujarat”,
“city”:”Ahmedabad”,
“zipCode”:”380061″
}
}

Decoded Name: –
Kevin

Decoded Address: –
Address(state: “Gujarat”, city: “Ahmedabad”, zipCode: “380061”)

Conclusion

So that’s it for blog part 2, lets hope for more this type of features and enhancements in final version.
Happy Coding !!

mm

Kevin Shah iOS Developer

I am Kevin Shah, iOS Developer at Yudiz Solutions Pvt. Ltd. - a leading iPhone App development company. I am a tech savvy Guy. Passionate about Mobile Technology, Cricket and Gaming.

Comments are closed.

Top