Add your own spin to Swift

Let’s be honest. Swift and Apple’s frameworks don’t have all the functionality we need to build the best software for Apple devices. Fortunately, Swift supports extensions so we can add the missing pieces we need to make our lives easier.

If you’re new to Swift, please refer to the documentation to learn more about Extensions before continuing.

In this article, I will focus on extensions that add additional functionality to existing types. Extensions can also add default implementation for Protocols, add constraints to protocol types, and more.

When creating your own extensions, I would recommended creating a handful of unit…


A basic to intermediate introduction to JSON and Swift

Photo by Safar Safarov on Unsplash

Introduction

JSON is one of the most common data formats for transferring data between servers and devices.

This will be a two part series. The first part will cover what JSON is and the basic handling in Swift while the second part will be focused on retrieving JSON from the web via URLSession and Alamofire.

If you would like to follow along, please download the sample project from my GitHub.

What is JSON?

JSON stands for JavaScript Object Notation. JSON is a lightweight format for storing and transporting data. The JSON format consists of keys and values. In Swift, think of this format as…


https://unsplash.com/photos/ZVprbBmT8QA

Creating a UITextField to handle currency input might seem easy enough until you actually start writing the code. The first issue you will probably come across is how are you going to restrict the user from entering anything other than numbers. Then you might realize that forcing users to enter periods and commas isn’t the best user experience. Here are some additional issues you will run into:

  • Not all regions and countries have their currency symbol on the left like in the United States.
  • Some regions and countries switch the placement of commas and periods.
  • Some currencies are formatted as…

Add a database that isn’t Core Data to your app today

Realm logo

The Realm mobile database is a data-storage solution for mobile and web development. At the time of writing this article, Realm offers a solution for Java, Kotlin, Swift, Obj-C, JavaScript, and .NET. As the article title indicates, we’ll be focusing on iOS — and specifically, Swift. This article assumes you have a basic understanding of Swift and iOS development.

At the time of writing this article, you can use the Swift Package Manager (SPM), CocoaPods, or Carthage to add Realm to your project. I’ll be using SPM in this guide, as it’s the quickest and easiest way to get started…

Josh Rondestvedt

Software Developer at Livefront. Founder of the iOS app seventytwo. I build cool software for Apple devices.

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