New behaviour for URL(string:) initializer in iOS 17

It is weird to have breaking changing in the bahaviour of the Foundation library APIs depending on the target platform. Before iOS 17 the URL(string:) initializer failed when the string argument was not a valid URL.

    let url = URL(string: "invalid url")
// in iOS >=17 this is a valid URL object with value invalid%20url
// in iOS <17, MACOS 13.6, Linux this is nil
Continue reading New behaviour for URL(string:) initializer in iOS 17

The case of Apple’s changing identifierForVendor

We had a case where a client reported a bug in our iOS application, affecting all its users, after publishing an update that had unrelated code changes. We traced the problem on the fact that the identifierForVendor value suddently started to returned different value, due to a change unrelated with our release that was undocumented.

Using the preprocessor to conditional include segments of Plist files

It common for all but the most trivial applications to conditionally compile parts of the code to enable/disable features or change configurations. Changing the server endpoint URL or enabling a feature to prominent show current version for QA only releases is quite common.

This can be easily done using Swift’s Active Complication Conditions or using preprocessor tokens in Objective-C. So as far as the source code we have a solution for conditionally including parts, but how about plist files, or in general other text resources? How can you run the preprocessor to any plist file so that you can write something like this

   <key>DefaultValue</key>
#if FIREBASE_PERFORMANCE_COLLECTION_ENABLED==1
    <true/>
#else
    <false/>
#endif
Continue reading Using the preprocessor to conditional include segments of Plist files

Attending VoxxedDays Athens Conference

Last Friday(30 September 2022) I attended VoxxedDays, looking back and comparing my experience at previous VoxxedDays (2019) it seems the apparent quality has increased but at the end of the day although I was impressed I felt having learnt less, perhaps I know more now so there is less room for new knowledge.

The best presentations are those from people who have struggled with a problem, documented their attempts and failures until they finally succeeded(this might be optional) and then spent time to put together a presentation of their journey, a lesson for the road untraveled by the rest.

Continue reading Attending VoxxedDays Athens Conference

Attending BetterWays Conference

Last Friday, September 23 2022, I attended an Agile Conference #BETTERWAYS2022 and I have to say that its great to be back in person for a conference. The last few years with the pandemic I have didn’t had the change to meet and talk with people in the community in person and it is something I have been missing.

Continue reading Attending BetterWays Conference

Compile time assertions

In software engineering it is important to fail early and loudly, when problems are detected. Meaning that your program should report problems that, if left unsolved can lead to undefined behavior, as early as possible and in a way that is visible. This makes problems easy to detect and fix as soon as possible.

The earlier you can detect a problem is at compile time, and the “loudest” is to produce a compile error. Wouldn’t it be wonderful if you where sure your program was correct if it compiled?

We are familiar with assertions that are performed at runtime, methods like assert() can validate if we have a state that we can not meaningfully recover from and prevent an program from continuing to execute.

Continue reading Compile time assertions