Apple WWDC 2018 — What’s new on iOS 12, App Store Connect and Xcode?

Here some code & feedback on sessions about iOS 12, App Store, In-app purchase, APIs, etc. from the best sessions I attended during this WWDC 2018.

11 min readJun 13, 2018

--

I share with you some of the best features & APIs to know on iOS 12 and development environment features. There is a lot to cover, so I preferred to focus on specific ones. I will not cover here the new features around Business Chat, ARKit 2, CoreML, or Siri Shortcuts.

What’s new in App Store & App Store Connect?

There are great news around App Store!

First, new Mac App Store. It’s just an adaptation of the iOS one. Finally!

Source: Apple

Next, yes: new name! No “iTunes Connect” anymore.

The main new feature is the App Store Connect APIs 🤩. All new features below are based on those APIs. Apple made a RESTfull API based on JWT (JSON Web Token) with extensive documentation. It will be available this summer via http://api.appstoreconnect.apple.com/.

By creating a dedicated API, Apple offers more flexibility to developers & App Store users to manage their app environment.

Provision

You will be able to create and manage certificates & provisioning profiles as you do with Fastlane match.

Manage users

You’ll be able to invite new users, modify app access & update roles, delete users via the APIs.

The significant feature is about setting roles. Now, for each user, you will manage Apple Developer roles and App Store Connect ones at the same right place: App Store Connect.

Deliver

Let’s go the point: ITMS Transporter is now available on Linux 🚀! Submit apps on from your CI tool will be possible. Also, there will be a validation of your binary before submit it, and the API is based on token authentification.

Beta test

Perhaps the best part. Now, you’ll be able to create TestFlight Public Link. YES! For instance, you can create a testers group, like “WWDC”, add the binary for testing, limit the number of public users for testing if needed, click on the “Create public link”. And boom: you can share the link via social media, mail, messages, everything! Then, users will click on the TestFlight link, install the app from the TestFlight app, and: it’s done.

If you set a tester user limit, the user who will attempt to install the app will have a prompt saying that there are no more available slots according to the limit.

To go back with the API, you will able to create groups, assign a build to groups, manage public links, add and remove testers, and finally update test information.

Analyze

There is a lot of improvement in sales & trends. First, the Website reports are improved, with better segmentation and precision around app download statistic, like territories, devices, in-app purchases, and retention.

App Store Connect App for iOS

The official app was completely be improved. You’ll be able to access and filter on reports like you do on the Web interface. The app is also optimized for iPad.

Source: Apple

You will also be able to manage and controls App Store Connect Notifications, like app status changes, ratings or reviews. At last, you can reply to customers on their review, just in your hands.

Search Ads

It’s official, Search Ads will be available in new countries: France, Germany, Japan, Italy, Spain and South Corea!

Free-trials for Paid Apps on the App Store

Yes, you read it well: free-trials \o/. Users will be able to try the app before they buy it! The trick is about to convert your paid app to a free app:

  • Free non-consumable in-app purchase
  • Unlock features with paid non-consumable in-app purchase

To respect the new App Store Guidelines, be sure that you show correct wordings to the users, like:

  • The trial duration;
  • The cost to unlock features after the trial;
  • The features that will be no more available after the trial ended.

How about Fastlane?

Felix says it well: fastlane do more around App Store APIs.

More information here around App Store Connect:

Related App Store WWDC18 Sessions:

301 — What’s New in App Store Connect

303 — Automating App Store Connect

704 — Best Practices and What’s New with In-App Purchases

What’s new in Xcode?

Well, it’s pretty impressive how you will optimize your builds and testing time on your apps with Xcode 10.

Xcode 10 — Testing

In Xcode 10, you’ll be able to use the randomized option to run your tests. So, if your tests are independent, it will reinforce & check independencies by executing tests randomly.

The major update is about parallel testing. The key is: one test class = one runner. You will divide the test execution duration by 4. Xcode 10 will use multiple runners instead of one to run unit tests in parallel.

For the UI Testing, the original simulator will not be used. Only clones of the original simulator will run the tests via one runner for each. Keep in mind that Unit & UI parallel testing is available on iOS, and only Unit Testing on macOS.

Xcode 10 — Playgrounds

What about playgrounds? Well, the good one is “Step by step playgrounds”. Now, you can write your code, run your playground, pause it, add some code & continue running it. Pretty productive mode! Also remember the new feature introduced in Xcode 9.3 & Swift 4.1 : CustomPlaygroundCustomConvertible. You’ll be able to have custom and better representations of our types in playgrounds. It replaces the CustomPlaygroundQuickLookable.

Xcode 10 — Better, faster, stronger

There is a lot to say about Xcode 10 improvements: source control, compilation time, debugging, etc. Read and watch the link below to learn more about them.

A good one by

to learn more about Xcode 10:

Related Xcode WWDC18 Sessions:

412 — Advanced Debugging with Xcode and LLDB (You have to watch this one!)

415 — Behind the Scenes of the Xcode Build Process

408 — Building Faster in Xcode

402 — Getting the Most out of Playgrounds in Xcode

418 — Source Control Workflows in Xcode

409 — What’s new in LLVM

403 — What’s New in Testing

228 — What’s New in Energy Debugging

404 — New Localization Workflows in Xcode 10

What’s new in user notifications?

iOS Notification team makes huge improvements for developers & users.

New delivery option

There is an essential change on iOS 12 to keep in mind: all notifications will be automatically delivered, quietly in the Notifications Center. This automatic trial will not provoke prompt anymore.

In able to do it, request notifications authorization with the new provisional type:

let notificationCenter = UNUserNotificationCenter.current() notificationCenter.requestAuthorization( options:[.badge, .sound, .alert, .provisional])

Grouped notifications

WOOOOO! (clapping)

By default, if you’ve not provided a default thread identifier, notifications will be automatically grouped. The user will still have the chance to change it in the grouped notifications setting, by turning it off, automatically or by apps.

The best practice is to not overriding default features of your app. For instance in Mail, Apple not group notifications by email-thread conversations. But they group emails by user groups or account groups (VIP, Gmail, iCloud, etc.).

Source: Apple

If you want to customize notifications groups, use the existing thread identifier property:

let content = UNMutableNotificationContent() 
content.title = “New Photo”
content.body = “Jane Doe posted a new photo”
content.threadIdentifier = “thread-identifier”
//In the APNS payload:
{
"aps" : {
"alert" : {
"title" : "New Photo",
"body" : "Jane Doe posted a new photo",
"thread-id" : "thread-identifier"
}
}
}

Dynamic notifications

A new properties give the chance to update the actions in the notification extension. It’s a great new feature! You can imagine updating a Like action to an Unlike action, or adding / removing actions.

extension NSExtensionContext { 
@available(iOS 12.0, *)
var notificationActions: [UNNotificationAction]
}
// Notification Content Extensions class NotificationViewController: UIViewController, UNNotificationContentExtension { func didReceive(_ response: UNNotificationResponse, completionHandler completion: (UNNotificationContentExtensionResponseOption) -> Void) { if response.actionIdentifier == "like-action" { // Update state...
let unlikeAction = UNNotificationAction(identifier: "unlike-action", title: "Unlike", options: [])
let currentActions = extensionContext?.notificationActions
let commentAction = currentActions![1]
let newActions = [unlikeAction, commentAction]
extensionContext?.notificationActions = newActions
}
}
}

But it’s not the only new feature around notification extensions. Now, you’ll be able to interact with the UI extension!

To be able to do it, add the new option in your .plist file:

UNUserNotificationExtensionUserInteractionEnable:YES

By adding user interaction capabilities, i.e some Outlets buttons in your code, you probably want to make the button acts as the user tap on the notification. Well, do to that, there are two new APIs:

extension NSExtensionContext {   @available(iOS 12.0, *) 
func performNotificationDefaultAction()
}import UserNotificationsUI class NotificationViewController: UIViewController, UNNotificationContentExtension { @IBOutlet var allCommentsButton: UIButton?
...
allCommentsButton?.addTarget(self, action: #selector(launchApp), for: .touchUpInside)
...
@objc func launchApp() {
extensionContext?.performNotificationDefaultAction()
}
}
extension NSExtensionContext {
@available(iOS 12.0, *)
func dismissNotificationContentExtension()
}
import UserNotificationsUI class NotificationViewController: UIViewController, UNNotificationContentExtension { @IBOutlet var likeButton: UIButton?
...
likeButton?.addTarget(self, action: #selector(likeButtonTapped), for: .touchUpInside)
...
@objc func likeButtonTapped() {
likedPhoto()
extensionContext?.dismissNotificationContentExtension()
}
}

Critical notifications

Critical notification will be delivered with sound and on screen, even if the Do not disturb mode is enable. They have a red-warning icon and a custom configuration setting into the app settings.

Apple limits the critical notifications usage to medical, health, home, security apps. Moreover, you have to ask specific entitlements to Apple via https://developer.apple.com/contact/request/ notifications-critical-alerts-entitlement/.

Here the Apple example with Glucose Monitor:

After having you special entitlements, user have to be prompted with the critical notifications alert:

let notificationCenter = UNUserNotificationCenter.current() notificationCenter.requestAuthorization( options:[.sound, .badge, .alert, .criticalAlert]) { }

You’ll also be able to change the critical notification sound and its volume:

let content = UNMutableNotificationContent() 
content.title = “WARNING: LOW BLOOD SUGAR”
content.body = “Glucose level at 57.”
content.categoryIdentifier = “low-glucose — alert”
content.sound = UNNotificationSound.defaultCritical
//orcontent.sound = UNNotificationSound.criticalSoundNamed(@”warning-sound” withAudioVolume: 1.00)

It’s a good news for Home Security & Medical apps to advert the user in any cases!

Related User Notifications WWDC18 Session:

710 — What’s New in User Notifications

711 — Using Grouped Notifications

806 — Designing Notifications

What’s new in Cocoa Touch & UIKit APIs?

More Swifty!

The UIKit team makes efforts about making APIs more Swifty with Swift 4.2, as nested types. Today, you’ll be able to write those lines of code:

// Swift 4.2 (Swift 4: UIApplicationState.active)
class UIApplication : UIResponder {
enum State {
case active
case inactive
case background
}
}
// Swift 4.2 (Swift 4: UITabBarItemPositioning.automatic)
class UITabBar : UIView {
enum ItemPositioning
case automatic
case fill
case centered
}
}
// Swift 4.2
struct UIFloatRange {
static let zero: UIFloatRange
static let infinite: UIFloatRange
}
// Swift 4.2
let insetRect = originalRect.insetBy(insets)
let pngData = image.pngData()
// No more ugly UIEdgeInsetsInsetRect(originalRect, insets)!
// Swift 4.2 — Codable Conformance
let encoded = JSONEncoder().encode(CGPoint(x: 0, y: 0))
let decoded = JSONDecoder().decode(CGPoint.self, from: encoded)
// Swift 4.2 — Debug Printing
print(CGPoint(x: 0, y: 0))
print(“Offset: \(UIOffset(horizontal: 10, vertical: 10))”)

Automatic Strong Password and Security Code AutoFill

Source: MacRumors

To be able to propose Security code AutoFill in a UITextField, there is a new type:

let passCodeTextField = UITextField()passCodeTextField.textContentType = .oneTimeCode

To allow iCloud keychain propose an auto-generated password, use the new type and new password rules capabilities:

let createNewPasswordTextField = UITextField()let newPasswordReqs = UITextInputPasswordRules(descriptor: “required: lower; required: digit; max-consecutive: 3; minlength: 12;”)passwordTextField.passwordRules = newPasswordReqspasswordTextField.textContentType = .newPassword

Now, when iOS suggests a new password, these rules will be used to generate it.

To help you defining password rules, Apple provides a Website for it:

Related topic: is this new iOS feature a security risk for online banking?

Some UIKit & Core updates

  • A funny detail is a DarkMode API on iOS. Perhaps it’s available today to use it on macOS in the future. As Apple announced it, you’ll be available to use UIKit APIs on macOS in 2019. Here it is:
@available(iOS 12.0, *) public enum UIUserInterfaceStyle : Int {
case unspecified
case light
case dark
}
  • It’s now “official”, after Apple recommended last year: UIWebView is deprecated. It’s time to switch to the WKWebView APIs now.
  • Business Chat is more open than ever before. Reminder, since iOS 11.3: Business Chat APIs provides Chat default buttons in a Dark or a Light mode to display them into your app.
import BusinessChat class ViewController: UIViewController {     func setupChatButton() {      let button = BCChatButton(style: .light)   
#if os(iOS)
button.addTarget(self, action: #selector(buttonTapped(chatButton:)), for: UIControlEvents.touchUpInside)
#elseif os(macOS)
button.action = #selector(buttonTapped(chatButton:))
#endif
button.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(button)
}
}
  • New Network framework: Use this framework when you need direct access to protocols like TLS, TCP, and UDP for your custom application protocols. Continue to use URLSession, which is built upon this framework, for loading HTTP- and URL-based resources.

Watch related UIKit WWDC18 sessions here:

202 — What’s New in Cocoa Touch

235 — UIKit: Apps for Every Size and Shape

219 — Image and Graphics Best Practices

225 — A Tour of UICollectionView

204 — Automatic Strong Passwords and Security Code AutoFill

220 — High Performance Auto Layout

That’s all!

I hope you’ve learned some new features & tips! Clap if you like it!

Don’t forget to comment if you notice some useful features & APIs that I’ve probably missed around the related topics.

Thank you for reading this post. Don’t forget the previous part around the WWDC18 before and WWDC18 keynote.

There is a lot to say around Siri Shortcuts, ARKit 2 or CoreML 2, here the WWDC18 sessions & related links:

708 — What’s New in Core ML, Part 1

709 — What’s New in Core ML, Part 2

712 — A Guide to Turi Create

717 — Vision with Core ML

603 — Integrating Apps and Content with AR Quick Look

602 — What’s New in ARKit 2

--

--