Our DNA is written in Swift

Category Archive for ‘Q&A’ rss

QA: Apple slowing down older iPhones

Tara from MacFixIt Australia asked:

Do you think Apple deliberately slowed down the performance of the older iPhones?

Sorry, but everybody following the story knows what happened and that the question is wrong. Rather you should have asked it to be technically accurate.

Update, April 28th: MacFixIt Austria used parts of my comment in a larger post.

Read more

The Exclamation Function

Four months ago, I reported a scenario where LLVM would crash with a segmentation fault. A later Xcode version fixed the LLVM crash, but now the crash would occur during runtime. This surprised me: Why would it be valid syntax accepted by the compiler, yet crash during execution?

Read more

Steve’s Senior Moment

Stefan “Steve” Gugarel came on board of Drobnik KG on April 1st, 2012. He took over main responsibility of the day-to-day development for our most important client at that time. Now, in 2016, he has accrued 8 years of experience in software development, which earns him the status of Senior Developer.

With the average churn in IT being at around 2 years, it is unusual for anyone to stick around that long. So why did he? We asked him.

Read more

Proportional Layout with Swift

Octavio asks:

I have an Autolayout challenge for you: I have a Square view which contains some images, labels, etc. We need that view to be full width on all iPhone screen sizes & resolutions.

The view is built at 320 x 320 (or @1x) and it is expected to scale proportionally for each and every other resolution and screen size. Basically, the view and all its elements should scale together, in unison, as if it was an image.

Thanks, Octavio, for a great question/challenge!

My first reaction was: “this is a problem I had solved previously!” But to make it a bit more interesting this time I am doing it with auto layout and Swift. We might learn something in the process.

Read more

Core Image Barcode Erratum

Barcodes with iOSSince iOS 7, Core Image contains several generators for 2D barcodes. While I was writing my book Barcodes and iOS, only the CIQRCodeGenerator was documented. Apple’s standard policy is that classes which are not documented are to be considered off limites. Seeking clarification, I emailed an Apple evangelist and he confirmed that this is still the case.

So I mentioned the three other – undocumented – Core Image filters in the chapter about barcode generation, but cautioned the reader about their usage in app store apps: CIAztecCodeGenerator, CIPDF417BarcodeGenerator and CICode128BarcodeGenerator. At WWDC 2015, I learned that my assumption as well as the evangelist’s confirmation were incorrect.

Read more

Keychain Management Revamped

For the past several years I have been using an ugly hacked together class AccountManager in several projects for saving and retrieving generic passwords on the keychain. A couple of months ago I finally got around to replacing this with a well-designed thought-through component, DTKeychain, which works equally well on iOS and OS X.

Read more

Square-Cropping Images

Christian asks:

How would you – most elegantly – crop out the center square of an image, preserving the aspect ratio and output the image with a given size?

That’s a good question. There is a “classic” and a “modern” method to achieving this.

Read more

Should I switch to Swift?

Angelina asks:

I was very surprised when I heard about Swift.  I was curious what your thoughts are about Swift and phasing out Objective-C specifically since you are in the process of writing the Barcodes book.  Are you going to update your book to use Swift instead of Objective-C?

Read more

Q&A: Seconds Since my Birthday

Julia asks:

How do I get Objective-C to display the number of seconds since my birth?

When you often gnaw on complex and frustrating questions – like I often do – it is rather refreshing to work out a good answer to such a simple question.

Read more

Updating CocoaPods

CocoaPods is being under constant development, and as the zero as major version number suggests, it is still in unstable status. So you should only be mildly surprised if calling the pod command outputs that a newer version is available. Here are some tricks for updating.

Read more