Ipados

Implementing Parametrizable Shortcut Actions for your iOS Apps

Published on

All the way back to 2016, a group of very talented iOS developers released Workflow, a very popular app to let users create actions of different kinds within the system’s constraints. You could create and automate different tasks, such as controlling a server via SSH, downloading all the images from a website, and more… Much, much more.

Apple saw the power of the app and acquired it in March 2017. This was very exciting, but we didn’t hear anything from the app since. Until WWDC 2018. Apple revealed a new app: Shortcuts. This app was built on top of Workflow, and as an Apple app, it allowed it to do many things that Workflow just wasn’t allowed to do, such as toggling system settings, integrating it with other apps (!!), and it was also natively integrated into Siri.


AIiCloudSync

Published on

GitHub Repository


AIiCloudSync

AIiCloudSync is a simple Package written in Swift to synchronize specific UserDefaults with the iCloud Key Value store (NSUbiquitousKeyValueStore).

To use this package, create a single instance of AIiCloudSync, and keep a reference to it. Once you create it, you don’t need to worry about it any longer. It will automatically sync changes between iCloud and your local UserDefaults through the lifetime of your application. You can optionally receive notifications when the iCloud Syncs change so you can react accordingly.


Modern Backgrounds Tasks in iOS 13

Published on

In the article from last week, we explored the basic background execution APIs introduced since iOS 7. We explored how we could request additional time for a task to complete after entering the background, how we could defer downloads with URLSession, and how we could use silent push notifications to trigger background tasks.

The story with background tasks does not end there. iOS 13 introduced more APIs to do better background tasks, and that allow you to do things that weren’t possible before. Apple gave us the new shiny BackgroundTasks framework on WWDC2019. This framework gives developers more flexibility and less constraints to execute code while their apps are in the background. Not only that, but the old Background App Refresh APIs have now been deprecated in favor of a new, modern way to perform them for your app. This changes unifies with the new Background Processing tasks which lets you do more work in the background, while a device is charging, and more.


Background Execution on iOS

Published on

In the early days of iOS development, developers had no way at all to perform background tasks beyond a very limited constraints of tasks, like music playback. Modern demands go beyond allowing people to play music in your app while they use a different app, and we as developers need to adapt to these changes. VoIP, lengthy networking, and even silent pushes to keep an app updated are very common these days, and fulfilling these demands used to be hard, if not outright impossible.


Formatting Relative Dates With RelativeDateTimeFormatter

Published on

Formatting Relative Dates With RelativeDateTimeFormatter

A few weeks ago we talked about formatting content with NSFormatter, an abstract class from which multiple formatting classes inherit from to allow you to format different kinds of data in a human-readable form. NSFormatter is not only a class you can inherit from yourself, but as iOS evolves, more formatters will be added to its family. This week, we will explore a new member of this family introduced in iOS 13: RelativeDateTimeFormatter.


UserDefaults and Property Wrappers

Published on


**Important Note**

Soon after I published this article, Christian Tietze wrote a fair criticism of this idea here.

Once you understand how property wrappers work, you can use this article to apply it to user defaults. The main idea is that property wrappers allow you to store your values differently and even externally. That said, you may or may not want to implement this in a real app. I recommend you read this article first, and then go back to Christian’s to see more downsides of this idea other than the ones I mentioned below.


Intercepting Network Traffic with mitmproxy

Published on

If you have been programming mobile apps for a while, you must have used a web based API - JSON based or otherwise - and you have had to deal with bugs related to your requests and responses to a web service. You have likely asked yourself why some parsing code is not working as expected, or why a request seems to have an invalid format. Intercepting your own network calls with a proxy can help you find the answer to these questions.


New Search APIs in iOS 13

Published on

iOS has always provided interesting search APIs, but they have always been limited and doing the most interesting tasks required you to either write your own implementation or use private APIs.

iOS 13 has provided some very nice improvements to the UI search APIs. In this article we will talk about two of them.

UISearchBar finally exposes its text field

I have been using UISearchController and UISearchBar for a very long time, and I have always found it bizarre that Apple didn’t expose its underlying text field property. As of iOS 13, the search bar finally exposes it, in the form of a UISearchTextField object.


When CryptoKit is not Enough

Published on

This article is a continuation to my Common Cryptographic Operations with CryptoKit article. If you want to learn how to use CryptoKit, read that one instead, and come to this one when you need a feature not offered by it.

As I have been playing with the amazing CryptoKit framework in the past few weeks, I have discovered a few more things that CryptoKit currently doesn’t do. This is not generally a bad thing, and I think these limitations are related to what seem to be the goal of the framework:


Introduction to Patterns and Pattern Matching in Swift.

Published on

Swift is a beautiful language, but it hides some powerful features from developers who come from more “old-style” programming languages such as C++ and Java. One such feature is Pattern Matching, and it allows you to write some cleaner code when dealing with some operations.

For example, consider casting. Casting is a feature in the vast majority of statically-typed languages. Casting is considered to be an ugly operation by some, because when you need to cast, it’s usually because the language has a flaw that prevents it from telling you about the right data type underneath. This is specially true when you add in Object-Oriented Programming and classes are marked to return a super type instead of a specific subtype. With pattern matching, you can more cleanly check for datatypes without having to worry about crashes or weird behavior.