Take a look at my old standbys

Laptop and coffee on table
Laptop and coffee on table
Photo by on .

Whenever I start a new iOS Swift project, the first thing I do is import my Utilities and Extension files. They help me make my programming more efficient. Let’s have a look at my six favorite and most essential extensions.

1. Dropping Shadow Under UIView

When implementing modern designs, dropping a shadow under a UIView is often required. Instead of having to write multiple lines of code for each view, I use an extension:

Of course, every project might require some minor changes to the shadow style, but that can be changed in a central place.


Taking your popover controllers to the next level in less than 5 minutes

The result animation

Adding animations to your app can be a difference between appearing basic or professional. For this example, we will be using the following ready-made .

But you can create a new ViewController from scratch; learn how-to here:

#1 Open the ViewController

The first step is to open the ViewController. The XIB we will be using in this example is called RateMeViewController and to open it, we run:

let vc = RateMeViewController(nibName: "RateMeViewController", bundle: nil)//
// Make changes to vc (for example to modalPresentationStyle)
//
self.present(vc, animated: true)

This would open the ViewController without any fancy animations, but we want moooore. So, to…


Modularizing UI elements in your Xcode project

Photo by from

When projects grow, it becomes handy to modularize not only your code but also your UI elements. For this modularization, Apple provides an easy way to create a UI Controller and a XIB (neXt Interface Builder) in one.

#1 Create UI Controller and XIB

Once you decided on a type of UI Controller (View, TableView, CollectionView, etc.), go into File > New > File (⌘N) and select Cocoa Touch Class .


Using closures and finally getting a grip on your asynchronous API calls or database queries

Photo by from

Anytime an iOS app requires some asynchronous data fetching, like API’s or database queries, we need a completion handler, telling us when the data is ready to use. Swift has a completion handler included, so in most cases, there is no need for any third-party libraries like PromiseKit. So let’s get started.

#1 The void completion handler

First, let’s look at a completion handler that returns nothing, except telling us, “It’s done”.

func querySomething(completion: @escaping () -> Void) { 
//
//do something asynchronous (or synchronous, doesn't matter)
//
completion()
}

So, do use this function, we call it (like we would any other):

querySomething(completion: {…


The resulting input layover

In apps, developers often require certain information at different points inside the app. To ask for this information, we need to generate a layover and trigger it from wherever in the application we are.

The input layover will consist of 3 main elements. A title, a subtitle, and the actual phone number input field (you can change this to any input field you require, the user's height, email address, etc.). To trigger the layover, we create two buttons to save the input and give the user the option to delay the information (Do it later).

#1 Create a new UIViewController with a XIB

First, we create ourselves a…


A quick guide to properly encoding and decoding Firebase Firestore documents into an Array of Structs and maintaining the data in a Singleton Manager Class.

Photo by from

The Firebase SDK is an excellent adventure on iOS. Lot’s of different modules to choose from, lots of different functionality, and plenty of errors when building the modules. I’ve developed my one working strategy to query Firebase Firestore documents into my iOS Swift projects properly.

#1 The correct dependencies

Before we start programming, we need the correct dependencies in our Podfile. Add these two dependencies to your Podfile and run pod install.

pod 'Firebase/Firestore'
pod 'FirebaseFirestoreSwift'

#2 The Data Model

The data model is the Struct representation of what the document looks like in your Firestore. …


Why the Mac M1 performs under pressure like it came straight from the '90s

Photo by from

Upfront, the Mac M1 (I am using the Macbook Pro) is a marvelous piece of engineering. Apple managed to compact a huge amount of performance and battery performance into a machine that starts at only $1299. The maxed-out iPhone 12 Pro costs more than that. And the iPad Pro with roughly the same screen size (but double the storage) costs the same.

But

Yes, the almighty but. I have now been working with my M1 for a few months, and it slowly but surely became my primary machine for work. Upfront: I am not writing about the excessive SSD writing (by…


Security holes and how you can find and resolves them in your project

Photo by from

My work consists of many things. While working on a project from scratch is great, most of the time I am finishing/fixing work for someone else, consulting on possible next steps, or reviewing the code for performance and security. I want to share the worst developer-inflicted security holes I have seen in the last couple of years with you. And, of course, while we are on it, show how I fixed and resolved them.

1. Laziness wins: using UserDefaults for everything

In pretty much all of the projects I open, at least 95% of the user data is stored in UserDefaults. When using UserDefaults in Android (called…


Photo by from

As a great start for getting into freelancing, Fiverr gives developers all over the world the chance to get paid for simple work and consulting. It is both a great way to earn some extra bucks (on your flexible schedule) and even make a living during a crisis. While finishing works on Fiverr, I learned some important life lessons I want to share with you today.

1. Better Time Management

During the planning and execution process of development gigs, I learned how crucial it is to have perfect time management. When calculating the price for a gig (your earnings), you will primarily look at…


I will show you just how easy it is to auto-detect a link in a TextView!

Photo by from

When browsing different articles and StackOverflow, it feels a lot harder to auto-detect any type of links in a TextView than it is.

1. Create a TextView

We start by adding a UITextView to a storyboard like this. Align both horizontally and vertically.

Mats Bauer

Mobile application developer and health enthusiast from Hamburg

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