- Apple Arcade
- Apple Arcade $4.99 a month with a one month free trial
- Apple TV+, available November 1st for $4.99/mo, free 1-year subscription with the purchase of a new device.
- New 10.2” iPad
- Announced the Apple Research app
- Apple Watch Series 5
- Always-on display on the Apple Watch Series 5!
- iPhone 11
- iPhone 11 has an ultra-wide camera, new UI in the Camera app for it
- iPhone 11 camera has night mode
- Slofies – Slomo Selfies
- iPhone 11 starts at $699
- iPhone 11 Pro & Pro Max
- Super Retina XDR Display on the iPhone 11 Pro
- iPhone 11 Pro battery lasts 4 hours longer than iPhone Xs, comes with fast charger in the box
- Deep Fusion image processing system on the iPhone 11 Pro
- iPhone 11 Pro available for pre-order Friday 5AM PDT, starts at $999
SwiftUI Tutorial – Creating and Combining Views
SwiftUI announced in WWDC 2019. It’s an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift. In previous blog I have shared some references from apple documents.
We will learn it by examples. First of all let’s start with simple UI.
Basic Resources For SwiftUI
Apple just announced SwiftUI today.
SwiftUI will be used to declare the user interface and behavior for your app on every platform.
Here are some basic resources to understand SwiftUI:
Apple Documentation
Tutorials for SwiftUI
Sample from WWDC 2019 Event:
Hope it will help you to look into it.
Happy Coding 🙂
Take advantage of raw strings in Swift 5
Swift 5 comes with enhancement in string literals delimiters to support Raw Text.
Little snippet to know if application is installed via TestFlight
I found little snippet from twitter about how to know if application is installed via TestFlight.
Here, appStoreReceiptURL
is an instance property, which we can find from main bundle.
Here, I am adding snippet for both Objective-C and Swift.
Warnings and Errors while upgrading from Swift 4.x to Swift 4.2 in Xcode 10.0
Following are warnings and errors will come while upgrading from Swift 4.x to Swift 4.2 in Xcode 10.0
Tutorial : Let's take quick dive in Grouped Notifications - iOS 12
With iOS 12 we can set the group of notifications
Thread Identifier
Create notification content with threadIdentifier
to create group of that notification. Group will be of the application or specific topic from an application.
1 2 3 4 5 |
// Creating Groups with Thread Identifiers let content = UNMutableNotificationContent() content.title = "Notifications Group" content.body = "Tutorial by Ashish Kakkad" content.threadIdentifier = "notify-team-ios" |
Notification payload will be like this
1 2 3 4 5 6 7 8 9 |
{ "aps" : { "alert" : { "title" : "Notifications Group", "body" : "Tutorial by Ashish Kakkad" } "thread-id" : "notify-team-ios" } } |
Give meaningful name to thread identifier for specific purpose of group.
Summary of group
Simple Notification Group Summary
1 2 |
let summaryFormat = "%u more messages" return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: []) |
Hidden Previews Summary Customization
1 2 3 |
let summaryFormat = "%u more messages" let hiddenPreviewsPlaceholder = "%u messages" return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenPreviewsPlaceholder, categorySummaryFormat: summaryFormat, options: []) |
Notification Group Summary with Arguments
1 2 |
let summaryFormat = "%u more messages from %@" return UNNotificationCategory(identifier: "group-messages", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: []) |
Notification Group Summary Argument
1 2 3 4 |
let content = UNMutableNotificationContent() content.body = "…" content.threadIdentifier = "notify-team-ios" content.summaryArgument = "Ashish" |
Notification Summary with Argument Count
1 2 3 4 5 |
let content = UNMutableNotificationContent() content.body = "…" content.threadIdentifier = "notify-team-ios" content.summaryArgument = "Ashish" content.summaryArgumentCount = 2 |
Updated notification payload will be like this
1 2 3 4 5 6 7 8 9 10 |
{ "aps" : { "alert" : { "body" : "…", "summary-arg" : "Ashish", "summary-arg-count" : 2 }, "thread-id" : "notify-team-ios" } } |
Example with local notifications:
Setup user notifications in the application.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
// // AppDelegate.swift // AKGroupedNotifications // // Created by Ashish Kakkad on 21/06/18. // Copyright © 2018 Kode. All rights reserved. // import UIKit import UserNotifications @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. let center = UNUserNotificationCenter.current() center.delegate = self let options: UNAuthorizationOptions = [.alert, .sound] center.requestAuthorization(options: options) { (granted, error) in if !granted { print("Something went wrong") } } center.getNotificationSettings { (settings) in if settings.authorizationStatus != .authorized { // Notifications not allowed } } return true } } extension AppDelegate : UNUserNotificationCenterDelegate { func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) { completionHandler([.alert, .sound]) } } |
Fire local notifications and look into the thread identifier, summary and summary count…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
if #available(iOS 10.0, *) { for i in 1...5 { let content = UNMutableNotificationContent() content.categoryIdentifier = "AKNotification" content.title = "Notification \(i)" content.body = "\(Date())" if i == 2 { content.threadIdentifier = "ak-notingroup" } else { content.threadIdentifier = "ak-group-website" content.summaryArgumentCount = 1 content.summaryArgument = "by ashishkakkad.com" } let trigger = UNTimeIntervalNotificationTrigger(timeInterval: TimeInterval(10*i), repeats: false) let request = UNNotificationRequest(identifier: "NotificationID\(i)", content: content, trigger: trigger) let center = UNUserNotificationCenter.current() center.add(request) { (error) in print(error?.localizedDescription ?? "") } } } |
Conclusion
I know that I haven’t described anything in detail. If I get time I will update this blog with details.
Happy Coding ?
If you have any questions, comments, suggestions or feedback then contact me on Twitter @ashishkakkad8.
Apple WWDC 2018 Updates
Apple WWDC 2018 keynote is completed in San Jose, California. Basically this keynote is software focused keynote.
Apple CEO Tim Cook announced iOS 12, macOS 10.14 Mojave, watchOS 5 and tvOS 12 with their features.
Tips for update CocoaPods and your project libraries
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
CocoaPods is built with Ruby and is installable with the default Ruby available on OS X. We recommend you use the default ruby.
Update your system
Update your system by following command in terminal.
1 |
$ sudo gem update --system |
Above command will install/update rubygems.
Install CocoaPods
Install CocoaPods in your system by following command in terminal.
1 |
$ sudo gem install cocoapods |
If you are getting errors above command then use following command.
1 |
$ sudo gem install -n /usr/local/bin cocoapods |
Check CocoaPods Version
1 |
$ pod --version |
Update CocoaPods Repository
We have to update CocoaPods repository with latest pod updates by developers. Use following command to update CocoaPods repository:
1 |
$ pod repo update |
It will take some time to update all sub repositories.
Update pod for your project
If you directly apply the command pod install then some time new pods will not be updated in your project. For that you have to remove that specific pod information from the pod file and you have to apply pod install command. It will remove pod from the project. After that again you have to add the pod information in the pod file. Again you have to apply pod install command to install new version of pod.
Follow the next steps:
1. Remove SomePod
from the Podfile
2. Run pod install
pods will now remove SomePod
from our project and from the Podfile.lock
file.
3. Put back SomePod
into the Podfile
4. Run pod install
again
This time the latest version of our pod will be installed and saved in the Podfile.lock
.
You can update single pod file as follows:
1 |
$ pod update 'POD_NAME' |
Remove all CocoaPods from a project
Install CocoaPods deintegrate and clean commands from terminal.
1 |
$ sudo gem install cocoapods-deintegrate cocoapods-clean |
Now you have to apply both command to remove all CocoaPods from your project:
1 2 |
$ pod deintegrate $ pod clean |
Happy Coding ?
List of known Xcode issues
Xcode is IDE for development of the iOS, macOS, tvOS and watchOS applications. Every year apple comes up with so many changes in this IDE. Xcode 9.3 released on March 29, 2018.
Here, I am listing out all the issues with the workaround.