Swift Snippet : Map Bool values with Generics in Swift

My problem

It often occurs while writing code that you need to assign a value of a certain type, based on the value of Boolean. To do this there are multiple ways, but the 2 most known are

1. The let’s-write-a-lot-of-code approach

I don’t like the first approach, because it creates a bloated codebase. A better way is to use the ternary operator (also known as the inline-if).

2. The one-line-star-developer (ternary operator) approach

You specify the Boolean you want to evaluate, add a question mark, followed by the value if the Boolean is true, followed by a colon, followed by the value if the Boolean is false.

Continue reading Swift Snippet : Map Bool values with Generics in Swift

TNInfoBubble – Prisma app info bubble component

I was using the Prisma app (like half of the world probably) and noticed the info bubble when you swipe with your fingers to adjust the strength of the effect.

This is my implementation (written in Swift) of this component, which comes with the Prisma look out of the box.

Continue reading TNInfoBubble – Prisma app info bubble component

Integrate Unity 5 in a native iOS app with Xcode 7

Integrate Unity 5 in a native iOS app

A few months back I published a blog post about how to integrate Unity3D within a native iOS application.  This tutorial was written for Xcode 6 & Unity 4 and in the comments there were a lot of requests for a new tutorial.

Tonight I found the time to make the video tutorial on how to integrate Unity 5 in a native iOS app with Xcode 7, so I hope you enjoy it!

Continue reading Integrate Unity 5 in a native iOS app with Xcode 7

3D touch peek and pop tutorial for your Swift application

3D Touch peek and pop tutorial

Apple added a touch-sensitive layer to the screen of the brand new iPhone 6s (plus).  With the coming of this new screen, they’ve added some new UI interactions like application shortcuts and peek and pop.

In this 3D touch peek and pop tutorial I will learn you how to implement this new way of interacting with your content by building a photo gallery.  When you press hard on the screen you’ll see a preview of the image and if you press really hard the preview will pop into a detail view.

At the end of this tutorial I’ll show you how to add preview actions. This way you can interact with the content without going to the detail view.  You can do this by swiping up while you are previewing the content.

Continue reading 3D touch peek and pop tutorial for your Swift application

New features in Swift 2

Swift 2

At the 2014 WWDC conference Apple announced Swift as a new language to write iOS app.  In February 2015 they released Swift 1.2, which fixed a lot of issues (especially with the compiler) and added new language features.

In June 2015 Apple announced at WWDC Swift 2, which will be made open source later this year.  In this post I will cover the new features in Swift 2.

Continue reading New features in Swift 2

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

Sandbox Unity app in an existing iOS app

I HAVE CREATED A NEW WAY TO INTEGRATE UNITY WITHIN AN EXISTING IOS APP. YOU CAN FIND THE POST HERE.

The problem

After my previous blog post on how to sandbox an iOS app inside of a Unity project, I got some questions on how to do the same but put Unity inside of an existing iOS app.

After playing around with it, I found a solution which works well for me to add Unity app in an existing iOS app.

Continue reading Sandbox Unity app in an existing iOS app

Add Unity3D in a native iOS application

I HAVE CREATED A NEW WAY TO INTEGRATE UNITY WITHIN AN EXISTING IOS APP. YOU CAN FIND THE POST HERE.

The problem

For a project I need to implement an augmented reality feature inside a native iOS application.  We chose to go with Unity3D and Vuforia to do the augmented reality bit, as it’s free and lots of people are saying it’s the best solution. The only problem when working with Unity3D is that the exported iOS project is not easy to implement in an existing project as we only need Unity3D for 2 views inside a project with some dozen other native UIViews. Continue reading Add Unity3D in a native iOS application

iCapital v1.5 released

This week a new version of iCapital got released in the App Store. It was my guinea pig app to learn myself Objective-C this summer when I broke my foot. It was an excellent learning app, because it covered a lot of new concepts which I had to tackle:

  1. Core Data
  2. Migrating data on updates
  3. Memory management
  4. Retina support
  5. Game Center

Now, 8 months later, I took a look at how I left my code behind in my repository and I thought it was a good thing to rewrite the whole app as I now have a much better understanding of the language.  Since then I created a new game Boring Meeting OXO, an iPad app (in a private store, but you can take a look how it works here, this was still in a development phase), and a few personal apps.  As I feel myself comfortable with the language now, I hope I can release many new apps soon (one is coming pretty soon :-)!

As with every update, I give away some promo codes you can redeem via the App Store. So for the quick readers, here are 10 promo codes:

AW66MN7A6H3E
EPYRKHW6N6NF
E4MEXAMHTFKM
MYR4JFYPWY6L
FHLN4TJA97EP
MEH34K39HR4K
7KN6MMYAAPW7
NF6KMNNYH399
HTFKEX49JEP4
L3T9FWLPYXLX

I hope you have fun with it!

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!