It’s a beautiful spring morning for an AppleEvent — Spring Loaded

On Tuesday, April 20, Apple ended their first event of 2021 by streaming a virtual keynote called “Spring Loaded” held at its campus in Cupertino, California.

During the event, Apple unveiled a new podcast subscription service and a bunch of new hardware products including the much-awaited AirTags, the Bluetooth tracker.

If you missed the event, here’s what you need to know.

Apple Podcasts Subscriptions:

Sorting on collection is very easy for single criteria. Swift already has a built-in function for that called sorted (Its in-place variant, called sort). But, sometimes we need to sort the collection by multiple properties or criteria.

To understand this, let’s create a simple struct for Student with the roll number, name, address, and age property.

In order to sort the student list by address we can use the following code:

Student.students.sorted {
return $0.address < $1.address

But what happens when the address value will be the same? That’s where multiple criteria sorting comes into the picture.

What is the meaning of multiple criteria sorting?


In Swift (or most of the programming language), the default method for sorting an array uses lexicographic order. That means string Foo12 does come before the string Foo2.

Example 1 (Lexical Sort):

Lexical Sorting

In most cases, we perform lexical sorting on our array. But there might be a scenario where we need to use natural sorting for a better look on for end-user. (eg. Sorting File Names). In the natural soring order, the string Foo12 comes after the string Foo2.

We can achieve natural sorting in swift using the localizedStandardCompare(_:) method from the Foundation framework.

Example 2 (Natural Sort):

Swift — OptionSet Type

In this article, we will learn what is OptionSet in Swift and how to create your own custom OptionSet.

What is OptionSet?

  • In Swift, OptionSet is a protocol to represent bitset types, where individual bits represent members of a set.
  • OptionSet is similar to enum, but they are designed to work as a set so we can use multiple values at the same time.
  • As OptionSet confirms to SetAlgebra protocol, we can use methods like intersection, union, contains, isDisjoint and several other methods that you might have used on Set.

As a matter of fact, Swift’s OptionSet protocol is the bridged version of…

Photo by Emile Guillemot on Unsplash

What is Swift Package Manager (aka SwiftPM or SPM)?

  • The SwiftPM is a tool for managing the distribution of Swift code just like CocoaPods and Carthage.
  • It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
  • The SwiftPM is included in Swift 3.0 and above enables us to manage Swift dependencies.
  • With the release of Swift 5 and Xcode 11, SwiftPM support added within Xcode itself.

Here’s a step by step guide for creating your first swift package in Xcode.

Recently, I have updated my Xcode to the latest version (Version 12.2 (12B45b), and my project running fine for real devices. But when I try to run on iOS Simulator I am getting the following error.

building for iOS Simulator, but linking in object file built for iOS, file for architecture arm64

To solve this problem we have to exclude arm64 for simulator architecture both from your project and the pod target.

Solution using Exclude Architectures

Solution for Project Target

  • Open your project in Xcode 12 and click on the targets
  • Navigate to Build Settings of your project.
  • Add Any iOS Simulator SDK with value arm64 inside Excluded…

Migrate your Swift project from CocoaPods to SPM
  • We’re using Cocoapods for several years, but Swift Package Manager (SPM) is new standard dependency manager which included in Swift 3.0 and above. If you are the one who wants to adopt SwiftPM in your swift project, this is how to do it right.
  • Before removing CocoaPods from your project, make sure all your dependencies are compatible with SwiftPM.
  • I’ve found one small tool spmready by Humi to check If all your dependencies are ready to migrate to SwiftPM or not.
  • If all your libraries are not compatible with SPM , then either you go ahead with CocoaPods + SPM

While developing mobile apps that require internet connectivity, it's significant to handle poor network conditions. Because mobile app users will likely to have a much slower network than we use while developing.

As a developer, you didn’t want to throw away your invaluable time looking for a location with a poor network to test the app. So there are some ways to simulate poor network conditions during development.

Simulate Poor Network on iOS Simulator

Apple’s official tool to simulate network connections on macOS for testing purposes is the Network Link Conditioner.

1) Steps to install Network Link Conditioner

  • Open Xcode and go to XcodeOpen Developer ToolMore Developer Tools...

House plant
House plant
Photo by marra on Unsplash.

Recently, I’ve designed one of the screens of my project using the Sketch application. I’ve given a shadow property to the element with blur and spread.

But when I try to replicate the same shadow effect in the iOS application, it doesn’t quite work. That’s because the spread property does not exist in the CALayer class of the CoreAnimation framework. Also, blur and shadowRadius don't produce the same effect as the Sketch app.

The following are the results of setting a shadow offset of (10, 10) and a blur radius of 10 with spread value of 3 in Sketch and…

During its annual September 15 hardware event on Tuesday, Apple announced the Apple Watch Series 6, Apple Watch SE, iPad Air, and iPad 8th generation. As rumoured before, Apple didn’t debut the iPhone 12 lineup at its September 15 event.

In addition to the hardware products, the company also announced a new subscription service, called Apple Fitness+, as well as Apple One service bundles to help keep things simple — and keep you subscribing.

Apple Watch Series 6

  • The next-generation model has the same design as the Series 4 and Series 5 but features improved internals and new finishes — including the blood oxygen…

Milan Panchal

iOS Team Lead — Mobile App Developer ǁ Swift ǁ Objective-C ǁ Lifelong Learner ǁ Blogger

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store