Tech

Observing and broadcasting

9 min read

The usual solution to observe and broadcast is to use NotificationCenter:

final class Post { // 1
 
   var title: String
   var body: String
 
   init(title: String, body: String) {
      self.title = title
      self.body = body
   }
 
}
 
extension Notification.Name { // 2
 
   static let LTHPostReceived = Notification.Name(rawValue: "com.rolandleth.com.postReceivedNotification")
 
}
 
final class PostCreationController: UIViewController { // 3
 
   private let post: Post
 
   // [...]
 
   private func savePost() { // 4
      // [...]
 
      let userInfo = ["post": post] // 5
      let notification = Notification(name: .LTHPostReceived, object: nil, userInfo: userInfo) // 6
Continue reading →

ChallengeBeat

3 min read

A few months ago [I was writing][1] about a new beginning and I mentioned a couple of projects. I would like to present one of them today. It took longer than expected, but we [launched][2] today and we're really happy about the results. I'll start with a really short intro:

Our lives are filled with habits; some are good, some are bad. Everyone wants to get rid of their bad habits, and we all want to increase the number and/or frequency of good habits; we all want to eat healthier, do more sport, be more productive, or procrastinate less.

Continue reading →

Easier NSLayoutConstraint interactions #2

3 min read

In a [previous post][1] I talked about a new struct (LayoutPriority) and a couple of extension methods on NSLayoutConstraint to ease interacting with them. But, as I later discovered, there is no need for the new struct – we can do the same thing on UILayoutPriority itself. Let's quickly see how.

First, we move all the properties along with the operators to the extension:

extension UILayoutPriority {
Continue reading →

Creating an interactive label

14 min read

I would like to write about how you can create a label that detects and responds to various UIDataDetectorTypes. Well, we won't really make use of UIDataDetectorTypes, but NSTextCheckingResult, since we'll be using an NSDataDetector. We already have [TTTAttributedLabel][1] available, but if you need something much more lightweight, like I did, follow along.

Continue reading →

Easier NSLayoutConstraint interactions

7 min read

In Swift 4 UILayoutPriority has become a struct, with an initializer and a rawValue, instead of being a rawValue of Float itself. This means that simple assignments became slightly harder:

let constraint = someView.leadingAnchor.constraint(equalTo: otherView.leadingAnchor)
// Swift < 4
constraint.priority = 999
// Swift 4
constraint.priority = UILayoutPriority(rawValue: 999)

Besides this, I've always had a pet peeve – activating constraints that require priority manipulation:

NSLayoutConstraint.activate([
  someView.leadingAnchor.constraint(equalTo: otherView.leadingAnchor),
  someView.trailingAnchor.constraint(equalTo: otherView.trailingAnchor)
])
Continue reading →

Runtime Sharks

45 sec read

One of my biggest dreams has always been to create a great product of my own, and/or be part of a great team that creates one. Today I took a step towards this dream, and I'm happy to announce that I started a small software company. For now it's mostly me, but I hope in time it'll grow. Such a mixture of feelings ...

Excited. Scared. Eager. Patient. Hard working. Tired. Restless. Hopeful.

Joyful.

By the end of the year we'll have two projects finished, and I can't wait to show them to you. Depending on the project and deadline, we might also be available for collaboration/hire, so don't hesitate to contact us.

IconJar

1 min read

The other day I gave IconJar a try. It's an app to store, group, preview, search and export your icons. I won't go into much detail, because the feature list is nicely presented on their website, but I'd like to mention one thing, the export function; it has to be one of the best I've seen so far: select one/several icons, select different sizes (manually, or a built-in preset), any color and a suffix/prefix, if desired.

On their website they also offer a few lists of hand-picked icon sets, free and premium, that might be worth checking out; no need to mention, but all of these are already packed in .iconjar files, for easy importing.

If you have a library of icons of any size and if you work with icons even occasionally, I'd wholeheartedly recommend you to at least give the trial a try.

Caret, a great Markdown editor

1 min read

I guess it's [that][1] [time][2] of year again, when I change the editor I use to write. The last editor I was using, LightPaper, hasn't seen any updates in the past year and a half, which is a bummer, because I really think it has potential, and it's already a pretty good app; it just didn't fit my needs/desires. I know, I'm spoiled when it comes to editors, but [I'm also][3] a sucker for clean, dark themes.

Recently, I stumbled across [Caret][4], which has everything I look for: in-line Markdown highlighting, syntax assistance, live and customizable (through CSS) preview, an easy-to-the-eyes dark theme and a great, language-aware, syntax theme for code blocks.

Continue reading →

The App Store and the state of pay to play

5 min read

Truth be told, I haven't installed a free game like this since ... as long as I can remember. I haven't played games like Candy Crush et al, so I don't really know if this is the standard or not, but I'd like to share my latest experience. You don't have to have experience with this genre, it's all generic stuff, or obvious enough.

I like tower defense games, and the other day I thought I'd give SurvivalArena a try. I saw it's a pay to play, but I thought it can't be that bad, I'll just progress slower; after all, it's a tower defense, what paywalls can there be?

Continue reading →