nefextension is useful for exporting snippets from your code selection to an image or clipboard right from Xcode.
Once you install the extensions you have to enable them.
Deques(pronounced “deck”), short for double-ended queues, are similar to
Array, but support efficient insertions and removals at both ends. This makes deques a great choice whenever we need a FIFO queue.
prependmethod to insert a new element at the beginning and
appendto insert an element at the end of a deque.
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.
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
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:
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.
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
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
We can achieve natural sorting in swift using the
localizedStandardCompare(_:) method from the
In this article, we will learn what is
OptionSet in Swift and how to create your own custom
OptionSetis a protocol to represent bitset types, where individual bits represent members of a set.
OptionSetis similar to
enum, but they are designed to work as a set so we can use multiple values at the same time.
SetAlgebraprotocol, we can use methods like
isDisjointand several other methods that you might have used on
As a matter of fact, Swift’s OptionSet protocol is the bridged version of…
SwiftPMis a tool for managing the distribution of Swift code just like
SwiftPMis included in
Swift 3.0and above enables us to manage Swift dependencies.
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.
Build Settingsof your project.
Any iOS Simulator SDKwith value
Cocoapodsfor 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
SwiftPMin your swift project, this is how to do it right.
CocoaPodsfrom your project, make sure all your dependencies are compatible with
spmreadyby Humi to check If all your dependencies are ready to migrate to
SPM, then either you go ahead with
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.
Apple’s official tool to simulate network connections on macOS for testing purposes is the Network Link Conditioner.