Swift and CocoaPods

Uh. XCode 6 is out in the developer preview version and Apple introduced Swift on the WWDC. We all love CocoaPods, but how to use the Pods in a new Swift project?

Let’s start with a normal Podfile for a test project called ‘cocoapods-test’

platform :osx, '10.10'
link_with 'cocoapods-test', 'cocoapods-testTests'
pod 'RaptureXML'

As you can see, I link also the test-target in my Podfile, because I want the Pods to also be available there.

Now lets execute the beloved

pod install
Successful included Pods
Successful included Pods

But now? We have a pure Swift project here, so how to I use the Objective-C resources in my target? The solution is already mentioned in the official Swift guide:

Fill out an Objective-C bridging header if you need to access Objective-C code from the same app target in your Swift file.

We need a bridging header, which Xcode automatically creates when you want to add the first Objective-C file to a Swift project. So we just add a file called “dummy”. This file I will delete later.

Yes, we want an objective C file now
Yes, we want an objective C file now

Then Xcode will ask

This is exactly what we want right now. A nice bridging header file.
This is exactly what we want right now. A nice bridging header file.

This auto-generation will also add the corresponding path to this header file into our Build Settings.

Build Settings for the Bridging-Header file
Build Settings for the Bridging-Header file

Into this header file we can then add our wanted Objective C headers like e.g.

#import "RXMLElement.h"

We can the use this library in our Swift files like e.g.

var rootXML : RXMLElement! = RXMLElement.elementFromXMLData(data) as RXMLElement

Designed by Apple in California – Inspired by Microsoft?

I remember this funny Gizmodo article from 2011 where Sam asked “why Apple is making everything looking like an ugly wild west”. And we have seen all this development during the last years where everyone tried to use as much skeuomorphic elements as possible in web- and mobile applications. I also like Dieter Rams, but enough is enough.

Dieter Rams Braun
UI elements inspired by Dieter Rams (by Adrian Olczak)

And all these ugly textures everyone hates during the 90s came back. And now – thanks to Windows Phone 8 (?) – the trend is going back to simplicity and clean interfaces.

Clean WIndows Phone UI
Clean WIndows Phone UI

TechCrunch wrote today about this years WWDC application and so I took a look on it and yes, it looks much more cleaner and flat than the older Apple applications.

WWDC 2013 App
Apples 2013 WWDC application.

Maybe Apple got some inspiration from the clean Windows UI design? Don’t know, but I like this development.

Change PRODUCT_NAME in iPhone project

I was just looking to change the value of the ${PRODUCT_NAME} variable and found this:

1. Go to “Targets” and then do a “Get Info” on the application name.

2. In the window that pops up, go to the “Build” tab.

3. In the “Setting” column, go to the “Packaging” section and expand it if it isn’t already expanded.

4. In that section, change the “Product Name” entry to the desired name.

Found here: http://discussions.apple.com/thread.jspa?threadID=1643724