Load assets from bundle resources in Cocoapods

The problem

Yesterday I stumbled upon a problem when I loaded a xib file within my development pod.

I checked StackOverflow and found a few threads with the same issue:

Continue reading Load assets from bundle resources in Cocoapods

Custom cells for UIPickerView with AutoLayout

For a project I needed to add a UIPickerView with custom cells using AutoLayout.  UIKit allows this via the UIPickerViewDelegate method pickerView(_:viewForRow:forComponent:reusingView).

The cell just needed an UIImageView and UILabel, so I thought it would be pretty straightforward to do, but there are some caveats you need to know. Big thanks to Tom Adriaenssen for pointing them out and not ruining my Sunday afternoon 🙂

Continue reading Custom cells for UIPickerView with AutoLayout

TNImageSliderViewController – an image slider gallery for Swift

The problem

Too many times a client has asked to add a sliding image gallery to an iOS app, so I wrapped it up in a little component. You can download it from GitHub.

Introducing an image slider gallery for Swift

I took some time to write this component, so it is easy to manage image slider galleries.  First I looked around on the web, but there was nothing that really fitted my needs, so the best thing to do in such a case is write it yourself :-).

Prerequisites

  • Xcode
  • iOS8+

Features

  • Horizontal scrolling
  • Vertical scrolling
  • Page control to indicate how many photos are in the list
  • Works in both orientations (landscape, portrait)
  • Cell reuse (works on UICollectionVIew)

Download

You can download the project on GitHub.  If you have any questions, just ask it on  Twitter, put a comment below or open an issue on GitHub.

The component is also available via CocoaPods.

Dynamically load Collada files in SceneKit at runtime

The problem

For an upcoming project, a client asked me if I could build a prototype which could load Collada files at runtime.  The flow has to be like this

  • User downloads Collada zip file while using the app (e.g. in-app purchase)
  • Collada file gets unzipped
  • Show the downloaded Collada file in the app

I started looking a possible 3D engines which I could use like Unity, but then I remembered Apple has released the SceneKit SDK which allows pretty high-level access, but with excellent performance.

Continue reading Dynamically load Collada files in SceneKit at runtime

Archiving your iPhone app and icon dimensions don’t meet the size requirements

I’ve just archived an update for iCapital and I stumbled upon a weird warning.

It said the following

icon dimensions (0 x 0) don’t meet the size requirements.  The icon file must be 57×57 pixels, in .png format

I double checked my build settings and my app icons had the right dimensions.  When I searched for the warning on Google, there were a lot of other people who also had the issue since they updated to XCode 4.2 and OSX 10.7.3.

Luckily it’s really easy to fix the issue. You just need to set ‘Compress PNG files’ to NO in your Build Settings and re-archive your app!

How to do a lightweight Core Data migration

Why do you need to migrate?

When you release an app and add new features, there will be a time you need to update you persistent store. This is easy to do when you are in a development stage, because you can just delete your app and the persistent store will be re-generated. But when you are live and people have downloaded your app, you need to be careful. They won’t like it if suddenly their saved data has disappeared!

Continue reading How to do a lightweight Core Data migration

iOS Face recognition

There is a nice API for face/person recognition on the internet at http://www.face.com/.
Their API provides quite a lot of interesting data, such as

  • Position of the eyes
  • Position of the nose
  • Position of the mouth (right, center, left bounds)
  • Yaw/roll/pitch rotation of the detected head
  • Attributes: gender, wearing glasses, smiling, mood, …

And the best of all … it’s a free service which gives you 5000 calls an hour to their API which is more than enough for a little experiment.

Continue reading iOS Face recognition