Integrating Objective-C with Swift

A Small Opening

In this article we will first go through how to integrate your Objective-C code into your new Swift code, and then go on to explain the interoperability between Swift and Objective-C and to close it all we will talk about CocoaPods. That will help you to connect existing Objective-C (Cocoa) code and libraries to new Swift projects for iOS 7 and iOS 8 apps that will run on the iPhone 6 and other iOS devices.

Objective-C integration with Swift

In the last WWDC among other stuff Apple announced their soon to be programming language Swift. After all the excitement that we all went through once we read/heard about the capabilities of Swift and after rushing and downloading Xcode 6 and iOS 8 to our computers and devices, we felt like our code is sad, alone and missing our good old libraries that we always counted on. So how do we actually use our good old libraries in our new Swift projects? For the next example we’ll create a sample app called “Colors”. The app will have one screen with six buttons whose names will be a color and its negative, for example : “black on white”, ”green on pink” etc. Once a certain button is clicked, the color and its negative will be applied to the color of the button and the view. Here comes the Objective-C code, the colors will be initiated through an Objective-C code that will take a string of a hex color and return a UIColor. Let’s begin!

We create a simple view application project:
Creating a new Xcode project

weiterlesenIntegrating Objective-C with Swift

iOS Navigation Drawer Solutions

iOS Navigation Drawer Solutions - Side Menu

As you may know, side navigation drawers (slide-in menu, side menu) are not implemented by Apple in their standard user interface library for iOS (as opposed to Google’s Android), nevertheless they are becoming more and more important. So naturally at some point you are going to find yourself in a situation where a navigation drawer for an iPhone App is a necessary step.

Of course you as an iOS app developer can always look online for some tutorials on how to implement yourself, which basically shouldn’t be a big problem, but you should ask yourself how much of your time would you like to invest in order to make the layout to work exactly how you planned in the first place.

If that is the case, here is a good tutorial to get you started:

For of you who are looking for a faster, more elegant solution here are two cool options:


iOS 7 style side menu with parallax effect inspired by Dribbble shots. It works both with and without storyboard.


weiterleseniOS Navigation Drawer Solutions