First release of SwiftRichString was take place in December 2016; as many other works it’s born for my own needs; NSAttributedString  management is one of the part of UIKit which owes lots from the Objective-C heritage and even if something is changed with Swift 4 it still have plenty room of improvement to fit well in a post Swift world.

SwiftRichString introduced the concept of Style  to define and collect a type safe collection of attributes you can apply to a plain or already-attributed string. The new 2.x branch is a total rewrite of the library which suits better with protocol oriented programming approach with several room for future improvements.

Main highlights includes:

  • a new optimized codebase; with a protocol oriented approach we have more room to improve the library keeping it clean and typesafe.
  • a new central repository for styles allows you to register styles with a name and used them all around the app without code duplication.
  • integration with Interface Builder allows you set the style to UI controls (currently UILabel , UITextField  and UITextView ) from globally registered styles and leave the library to render the content automatically!
View the article

As Apple’s developers we started facing the type-safe constraint in our code with the advent of Swift.

From my side I’ve always tried to fully embrace this approach even if often this means to come to a deal with several parts of the UIKit which are obviously created with a different – more dynamic – paradigm in mind.
Sometimes is easy, some other less, but they still a good excercise to think outside the box to keep our code safer and cleaner.

Recently I’ve re-faced an apparent trivial task; I would to read the configuration of an application saved inside the Info.plist file of the app.

View the article

Not so long ago I’ve published an article called “Forget datasource & delegate: a new approach to UITableView“; the title may appear as a bit pretentious but, believe me when I say I’m tired to fill-up datasource and delegates methods placeholders just to make a simple (or complex) table/collection.

I do not want to bore you with yet another article about massive view controllers but the whole thing is easy to become a big jumble when you want to implement some business logic and flexible rendering to represented data.

My first attempt to approach this problem ended in Flow, a little but useful utility which allows you to create and manage the content of a table in a declarative way. I liked it so much and I’m still using it in different production projects with success; however, as often happens in this work, time, attempts, failures and, in a single word, experiences helped me to better understand the problem, the implications of my solution by giving to you the opportunity to improve my original work.

The following article recounts the story behind the original idea and propose a new improved approach you can use both for UITableView and UICollectionView.

View the article

The secret world of NSTimer

By

In this article we’ll take a depth look at Timers and how it works; timer allows us to execute some piece of code after a timer interval one or more times. There are multiple types of clocks used to create timers and, even if apparently all ofthem run at the same rate, they still have different behaviours.

In the second part of this article I’ll present an NSTimer alternative made using GCD library which allows us to simplify our work with timer by removing memory management and thread constraints, also making our timer reusable and configurable.

View the article
@