miqu.me

var blog = Human.write()

My top 5 must-have technical books

Quite recently a team member wanted to suggest interesting technical books to read for a junior engineer. I figured I might as well write my top 5 books here, in no particular order. I believe every Software Engineer should own these books, but reading them is a very good start ;)

Read on →

Fixing autocompletion on mixed Objective-C and Swift projects

This year I had the privilege of attending WWDC for the first time. I knew the labs were very important, and I want to share a resolution to fix a problem for our big project at Peak: Autocompletion on Swift code was not working most of the time in the IDE, and with the help of an Apple engineer in the labs we got it sorted.

Update on 30/10/2017:

The issues described here seem to be fixed with latest release version of Xcode 9.0.1 (9A1004). Also the ‘internal’ menu doesn’t seem to be accessible anymore. If you know how to access it I’d love to hear from you!

Read on →


Build settings depending on Xcode version

This weekend I wanted to setup Precompiled Bridging Headers for my project. This setting is available in the new Xcode 8.3 beta. Then building for latest official XCode (8.2.1) the code will not compile because the Swift compiler doesn’t recognize it. How do we use different build settings for different Xcode versions? Only possible with xcconfig files.

There’s an undocumented build setting called XCODE_VERSION_MINOR that we can use here. And after some variable substitution we’ll make it work. Here’s the gist:

1
2
3
4
5
6
// Setting for last Xcode
OTHER_SWIFT_FLAGS_XCODE_0820 = //<previous flags, if any>
// Setting for Xcode Beta
OTHER_SWIFT_FLAGS_XCODE_0830 = -enable-bridging-pch
// Switch configuration based on Xcode version
OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_XCODE_$(XCODE_VERSION_MINOR))

Full credit to Samantha Marshall’s excellent writeups of xcconfig files. Take a read, very useful to refer to.



App extensions, Xcode and Cocoapods, OMG!

Have you encountered this error when upgrading to the latest CocoaPods (1.1.0), or sharing a library between your iOS App and your extension?

1
'sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.

If yes, continue reading, as you might have encountered same issue as myself. I’ve recently had to upgrade a project to using Cocoapods 1.1.0. Things stopped compiling, and I had to investigate the root cause of the problem. It has to do with iOS App extensions, unavailable APIs and how fragile our tooling is ;).

Read on →

Easy localization management with Google spreadsheets

Last thursday I gave a talk at NSLondon meetup called ‘Minimum Viable Tooling’. The topic was examples of approaching tooling and automation for small teams. I showed real examples of what we do at Peak, where I currently work. One of the things people showed interest in after the talk was how we deal with localizations.

In this post I will replicate the simple solution from scratch, so you can follow along and get started with your own projects. And we will be using Swift for the scripting, just because we can!

Read on →


Knowing when to delete code

Much of the literature and writing related to sofware development focuses on the creation, new ideas, fresh ideas and things to improve in your next project. But when is it a good moment to delete the old stuff in an long term project? Here’s my short rant about this; I recently deleted a chunk of code in my current project and just felt I wanted to write my thoughts.

Read on →


Dear SDK developer

As an application developer I get to use many third party code to integrate it into my current project. I want to share a checklist of things a user of an SDK really appreciates.

Read on →

Xcode 7.3 analyzer improvements

The latest xcode beta is available for downloading. There are many improvements, and the usual problems with stuff that stops working… Ah the love of Apple for it’s developers :). But I want to tell you about a feature that caught my attention: New analyzer settings!

New analyzer settings

From the release notes:

The static analyzer warns when nil is returned from a method or function with a nonnull return type or is passed to a parameter marked nonnull.

The static analyzer checks for common misuses of Objective-C generics.

The static analyzer checks for missing localizability. This check is off by default and can be enabled by selecting ‘Yes’ for ‘Missing localizability’ in the ‘Static Analyzer - Generic Issues’ build settings.

There are 3 new settings related to these new features: CLANG_ANALYZER_NONNULL, CLANG_ANALYZER_OBJC_GENERICS and CLANG_ANALYZER_LOCALIZABILITY.

CLANG_ANALYZER_NONNULL and CLANG_ANALYZER_OBJC_GENERICS

Objective-C continues to get some love! Adding into the changes for nullability and generics, now the analyzer will start to warn you about usage not in line with your annotations. That’s very good news, considering that the compiler checks were a bit lacking. Additional kudos because both settings are enabled by default.

CLANG_ANALYZER_LOCALIZABILITY

This is an intriguing one. Let’s investigate further; Let’s say you have some code where you set a string to a label:

1
label.text = @"not-localized";

You’ll now get a nice analyzer warning: “User-facing text should use localized string macro”

warning1

But you won’t get a warning when the key is not localized. Like:

1
label.text = NSLocalizedString(@"not-localized", nil);

Hey, we can’t have everything, but here’s my request for improvement submitted.

Anyway, go ahead and enable these new settings! And use the analyzer!


Transitioning iOS versions

Having worked in companies developing their own products, I’ve faced many times the problem developers encounter when building iOS applications: Your biggest 3rd party dependency - the OS SDK - is changing under you every year. How does your team deal with this in a maintainable way?

Read on →

Building Swift on OSX

Swift is finally open source! This is great because of many reasons, namely the transparency and chances to learn from the people responsible of building the foundational language you work on. I’ve been checking how easy was to build the runtime, REPL and compiler, and it turns out the team made an excellent job to make the process very easy. Let’s see how to do it.

Read on →

Three months with XVim

‘Know your key shortcuts’ is the mantra of the productive programmer. I’ve chosen to try using the same keybindings everywhere, investing time and learning Vim. And using xvim in Xcode. In this article I’m going to try to explain why I did this, and I’ll share my experience of the process.

Read on →



Poor man’s functional programming

It’s a very exciting time to be an iOS or Mac developer. The platform moves very fast and we got a new toy (language) to play with: Swift. It’s the perfect time to reevaluate, learn and evolve as a programmer, because you will be forced to adopt this new language (yes, I think Swift is the future, 100%).

I want to relate this to the fact that most iOS engineers, or mobile application developers, are traditionally familiar with Object Oriented Programming paradigm. But Swift offers more than different syntax and OOP.

I’m referring to some features inspired by functional languages. If you’ve ever had an interest, but never the chance or motivation to go forth and look into this paradigm, now it’s the perfect time to do it.

Read on →

Freehand Drawing

Yesterday my last post on the series ‘Let’s build Freehand Drawing for iOS’ has been published at Badoo Tech blog. It’s been a very good experience for me, and of course I recommend you visit the tutorials if you are interested.

I divided the tutorials in 3 parts:

  • Part 1: Introduces the feature and a naive implementation
  • Part 2: Adds undo functionality, refactoring along the way
  • Part 3: Improves stroke to make it look smoother

Building tutorials is hard

This series has been my first take on writing technical tutorials. And I must say that it’s a lot harder than I thought. You need to keep track of the content, code correctness, and the pace of the articles so it’s readable and understandable. Coding while writing an article is challenging, but the experience has been very gratifying.

I also get to brag about something I was really happy to build for the Bumble project. So I think I’ll definitely write other tutorials in the future.




Fragmentation

As an iOS developer or Apple-centric developer, WWDC is a time of excitement and news. The yearly event at Apple offers many networking opportunities, but most importantly sets the stage for the next year of development in the company’s platform. As this year event is closing in, I wanted to write my thoughts on a related, and often overlooked topic; fragmentation

Read on →

Adopting nullability annotations

Apple introduced nullability annotations to Objective-C compiler from XCode 6.3. I was really surprised by this change, and welcomed it with open arms when I saw the release notes. My first thought was: Objective-C is learning from Swift! I want to share my 2 cents on this new annotation and what it means for more modern Objective-C code.

Read on →





Tip: ExFat HDD with Raspberry Pi

A few days ago I switched my HDD on my Raspberry Pi to a SSD drive. I use the Pi as a NAS serving files at home and I wanted to use a HDD for music with less storage but more reliability. This drive runs 24/7. I also chose exFat for the filesystem. I write this as a future self-reference, but may be useful for somebody else, so here it goes.

Read on →


Travis + octopress = Yay!

I just finished setting up Travis CI integration with this blog. So now I don’t even need to do rake generate_deploy. Just git push to source and deploy after 3 mins. Happiness.

I based my config on Hari Menon’s post.

My small contribution to whoever happens to read this post is: Don’t forget to set up your user.name and user.email in Travis CI. Check my final travis.yml if you are curious.

Happy coding!


iOS Code Injection

Write code, compile, wait, navigate to screen in application. Fix problem, recompile wait. Oh it was not fixed, start again… Does it sound familiar? For compiled languages there seems to be no workaround this bottleneck. Even though this is true, there are situations where we can reduce the waiting time, increasing our productivity and happiness. Enter code injection.

Read on →

Technical fanatism

Whenever I meet some developer, I can always get a really interesting conversation. Be it tools, opinions on platforms, favorite blogs, books, or some new technique I didn’t know about.
That’s why it’s important to discuss with other people in the field their opinions, they challenge your assumptions and you can gain useful insights which otherwise would be hidden to you for longer. But sometimes, you hit a wall. Somebody does not listen.

Read on →


Apple watch: love it and hate it

Let me confess: I always loved smart watches. I am a geek and I like gadgets, I love to see new features ‘just because they are cool’. I own a Pebble watch and I love it, and I most probably will buy Apple Watch. But I think Apple did not solve the main issue with today’s mobile technology, and Smart watches in particular.

Read on →

Hello WWWorld

Hi there!

Welcome to my technical blog! I may write here from time to time. My intention is to write about technical stuff, mainly programming and iOS.