Authentication with signed requests in Alamofire

With almost 30.000 stars on Github, you can tell that Alamofire is a popular framework to use for iOS and Mac projects. It makes network implementations easy to do and allows us to sign requests using a RequestAdapter for authentication. Signing requests for authentication API’s often require you to sign requests using for example JSON … 

 

App Store Connect API adoption with use case examples

The new App Store Connect API was announced during WWDC 2018 and makes it possible to write applications for App Store Connect. It includes endpoints for the following areas: TestFlight. Manage beta builds of your app, testers, and groups. Users and Access. Send invitations for users to join your team. Adjust their level of access … 

 

Custom Operators in Swift with considerations for readability

Custom operators in Swift create extensions on existing types and can be great for readability improvements if used correctly. Considerations with custom operators For code solutions in your project, you’re probably more likely to define a custom method instead of a custom operator. With the right knowledge and considerations, you can easily create more readable … 

 

Measure the performance of code in Swift

It’s important in any type of programming language to know how to measure the performance of code as there are many different ways to write solutions and not every solution is as performant as the other. If a piece of code turns out to be slow in, for example, the results of the Time Profiler … 

 

Performance, functional programming and collections in Swift

Functional programming is often done in Swift and so easy that it could easily hit performance. Iterating over large collections and performing actions like filter or map is common and should be used wisely. Performance is often decreasing when these methods are combined, like a filter followed by first. A list of best practices. Prefer … 

 

SwiftLint valuable opt-in rules to improve your code

SwiftLint is a tool by Realm to enforce Swift style and conventions. It’s proven to be adopted by a lot of developer with over 10.000 stars on Github. 149 Rules are available for you to use from which a lot are enabled by default. In this post, we’re going over some valuable rules which are … 

 

Updating to Swift 4.2

Swift 4.2 is a major release and shipped with Xcode 10. It comes with a lot of code improvements for which the best way to start is to watch the WWDC 2018: What’s New in Swift session. Some of the improvements are easy to implement in your existing code. Replace strongSelf with self SE-0079 makes … 

 

Defer usage in Swift

Although the defer keyword was already introduced in Swift 2.0, it’s still quite uncommon to use it in projects. Its usage can be hard to understand, but using it can improve your code a lot in some places. The most common use case seen around is opening and closing a context within a scope How … 

 

CompactMap vs flatMap: The differences explained

CompactMap and flatMap, what are the differences and when do you use each? Swift 4.1 introduced this new method with the proposal 0187: Introduce Filtermap to gain more clarity in flatMap use cases. When to use compactMap Use this method to receive an array of nonoptional values when your transformation produces an optional value. See … 

 

Compiler Diagnostic Directives using a hashtag in Swift

The Swift standard library brings quite some compiler diagnostic directives by default. Although this might not ring a bell at all, a lot of them are quite known and listed in the Swift repository. Warning Warning can be used to manually trigger a warning on the given line. This can be useful during development to …