From viewWillAppear to viewIsAppearing - Perfecting Your iOS View Transitions
Oh my Swift
by Rizwan Ahmed A
5M ago
In WWDC23, Apple introduced a nuanced addition to the UIViewController lifecycle: viewIsAppearing. This instance method is a game-changer for developers looking to fine-tune the presentation and layout of their views. Let’s explore how this method enhances the way we build responsive and dynamic interfaces. The Role of viewIsAppearing viewIsAppearing is invoked after the view has been inserted into the view hierarchy but before it’s laid out, making it an ideal place for last-minute UI updates. Its importance is most evident when dealing with dynamic content that depends on accurate view geome ..read more
Visit website
Exploring the New Push Notifications Console from Apple
Oh my Swift
by Rizwan Ahmed A
11M ago
Apple has recently unveiled a powerful new tool for developers: the Apple Push Notifications Console. This innovative console simplifies the task of sending test notifications to Apple devices using the Apple Push Notification service (APNs). Understanding the Apple Push Notifications Console The Apple Push Notifications Console is packed with features designed to make managing and testing push notifications a breeze. Send Push Notifications One of the standout features of the Apple Push Notifications Console is its user-friendly web interface that allows you to effortlessly initiate push noti ..read more
Visit website
How to add a loader to an UIButton
Oh my Swift
by Rizwan Ahmed A
1y ago
Sometimes, we would require a button to show a loader with appropriate text when a long-duration task is done, such as downloading an image. Before iOS 15, we had to write a custom button or do some hacks to show a simple loader or an UIActivityIndicator inside an UIButton. Now, it is not the case anymore. UIButtonConfiguration provides showsActivityIndicator, a simple property using which we can hide/show a loader inside a button. We recommend that you visit this article if you are unfamiliar with UIButtonConfiguration. To hide the loader or activity indicator var configuration = UIButton.Co ..read more
Visit website
How to filter screenshots, cinematic videos, and depth-effect photos in PHPickerViewController
Oh my Swift
by Rizwan Ahmed A
1y ago
In iOS 14.0, Apple introduced a new way to pick images from the device’s photo library using PHPickerViewController. (If you are not aware of PHPickerViewController, I strongly recommend you to read about PHPickerViewController first.) Different apps have different requirements. For example, a hi-res video editing app might be interested in showing cinematic videos and videos. A screenshot stitching app might be interested in showing screenshots upfront. From iOS 16.0, Apple has introduced new APIs, making filtering media very easy. If your app wants to show cinematic videos, you can use the c ..read more
Visit website
Implementing a custom native calendar using UICalendarView in iOS16 and Swift
Oh my Swift
by Rizwan
2y ago
It was WWDC22 week, and I was browsing through my Twitter feed to get some updates about the latest Apple APIs. A person tweeted, “No matter how experienced you are as an iOS developer, you’ll always look it up how to set up a date formatter.” So I humorously replied to the tweet by saying, “Dates are hard ? .” After a while, something struck my mind, and I was curious to know if Apple had made improvements to the existing date picker. To my surprise, Apple introduced UICalendarView to create custom calendar views from iOS 16. At that moment, I could realize how easy it would become for an iOS ..read more
Visit website
Different methods to remove the last item from an array in Swift
Oh my Swift
by Rizwan
2y ago
Arrays are one of the most widely used data structures in Swift, and we deal with a lot of array manipulations. One such manipulation is the removal of the last element from an array. The three useful methods to remove an element from an array are dropLast(), popLast(), and removeLast() Let us give back to the community. Before getting started, show your support to indie devs by downloading their apps from the banner displayed below. It will help them build great apps. Winya: Best screen sharing app for iPhone/iPad Become a Streamer by starting a live stream from your iPhone/iPad to Twitch/Y ..read more
Visit website
Customizing UIButton in iOS 15
Oh my Swift
by Rizwan
2y ago
Buttons are an essential element in iOS apps. If you are developing an app using UIKit, you will probably use UIButton class to create buttons. Creating a button is a straightforward process, but it becomes problematic when it comes to customizations. Soon you will find yourself writing hacks for achieving your desired result. We all have been there, and we have done it. You are not alone. Luckily, iOS 15.0 gives us a new method to customize Buttons much easier using UIButton.Configuration. Let’s get started! A gentle request. Before getting started, show your support to indie devs by download ..read more
Visit website
Exploring Deque in Swift Collections
Oh my Swift
by Rizwan
3y ago
Deque (should be pronounced as “deck”) is a collection implementing double-ended queues. Deques are similar to arrays, but they have efficient insertions and removal of elements at the beginning and at the end. The indexing semantics are integer indices that are the same as arrays. Now let’s see a sample implementation of deque. var colors: Deque = ["Yellow", "Orange"] print(colors) // [Yellow, Orange] The above code implements a deque of colors with the strings yellow and orange. Deque operations Now let’s see some operations or methods unique to deques. 1. prepend - Adding an element at th ..read more
Visit website
Swap keys and values of a Dictionary
Oh my Swift
by Rizwan
3y ago
Dictionaries are one of the most commonly used data structures. Dictionaries come with keys and values where the keys are unique. Sometimes, there might be a situation where we would want to swap the keys and values of a dictionary. Let’s see how to swap keys and values of a dictionary in swift. While doing so, we need to make sure that the values which are converted to keys are hashable and unique, else the conversion will fail. extension Dictionary where Value: Hashable { struct DuplicateValuesError: Error { } init?(swappingKeysAndValues dict: [Value: Key]) { do ..read more
Visit website
Closure based actions in UIButton
Oh my Swift
by Rizwan
3y ago
iOS 14.0 brings us many improvements and new APIs using which the developers can write efficient code. One such API is the closure based action API instead of the addTarget method in UIControls. Yes, you heard me right—no more usage of addTarget methods, #selector(), and @objc annotation in front of methods. More importantly, we can write a closure based code using the action handler. Okay, enough talk, let’s dive into the code. Target-based UIButton. (iOS 13.0 and earlier) fileprivate func configureButton() { fileprivate func configureButton() { let button = UIButton(type: .custom) button.ad ..read more
Visit website

Follow Oh my Swift on FeedSpot

Continue with Google
Continue with Apple
OR