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.
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
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,
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.
In my previous article, we have learned how to integrate
SwiftLint into the Project. In this article, we’ll learn how to disable rules. Rules can be disabled either at the project level or source level.
If you don’t want to use the specific rule(s) for your project then you can disable those rules completely by configuring
.swiftlint.yml file as below:
# rule identifiers turned on by default to exclude from running
It is also possible to skip some files by configuring
.swiftlint.yml file as below:
excluded: - file1 - file2 …