Reading a JSON File in Swift [Bundle and Documents Directory]

Apps often need to read the content of JSON files for different reasons.

You can save static JSON data inside an Xcode project to populate your app or use it in SwiftUI previews.

Apps can also save data inside the device’s documents directory.

Swift Data to JSON String: Formatting and Pretty Printing

JSON data is often not human-readable because web servers strip all white space to save bandwidth.

Converting JSON data into a formatted string helps build decodable Swift types and is useful for debugging, saving data to a JSON File, and writing unit tests for an app’s JSON output.

Date decoding strategies in Swift [with Examples]

The Date type is a Codable type in Swift. However, dates are not straightforward to decode, like other types conforming to the Codable protocol, because the default format used by JSONDecoder is not standard in JSON.

Dates can be encoded using different formats in JSON data. To handle all these formats, the JSONDecoder class has a  dateDecodingStrategy property, which can be configured with several decoding strategies according to the date format you must decode.

How to Become an iOS Developer [2023 Salary and Skills]

Becoming an iOS developer is a great career choice that allows you to demand a high salary and work on interesting projects at top companies.

Learning iOS development can take time, but you can speed up the process and optimize your learning following the steps I outline in this article.

REST API Calls in Swift: iOS Networking Architecture [in SwiftUI]

You can make a REST API call in Swift in just three lines of code thanks to URLSession and async/await.

However, implementing a networking layer in a full-fledged app presents several architectural pitfalls.

In this article we will see how REST works, how to perform API calls in a SwiftUI app, and the best way to architect the networking layer of an iOS app.

Switch Statements in Swift: Selecting Among Multiple Options

Switch statements are a powerful tool for controlling the flow of your program based on the value of a variable or expression. Although they resemble if-else statements with multiple clauses, switch statements offer several advantages.