What's Possible with Swift for iOS? - Clearly Innovative | Web and Mobile DevelopmentClearly Innovative | Web and Mobile Development

We wrote the iOS mobile app for a client using Swift instead of Objective-C. Our development team still uses the same Cocoa Touch Framework APIs and Interface Builder for the UI. This provides access to all the native iOS features: navigation controllers, table views, collection views, maps, and push notifications.

We also implemented features not found in the Cocoa Touch Framework by leveraging modules and libraries that have been available to Objective-C developers for years. Normally, we would use CocoaPods to add 3rd party features, however Swift’s compatibility was not available for this kind of implementation at the time of development. Instead, we used a bridging header which is a simple file to help Swift recognize Objective-C header files.

 

Chat

In the app, there’s a built-in chat room for each team. There are also chat rooms for each individual event/game. We decided to use the Quickblox SDK which has modules for other features we might want down the road. While there are instructions for integrating the Quickblox SDK into an Objective-C project, we were able to integrate it into Swift with minor adaptations.

 

Image Upload

The app also allows users to upload team or game photos. This is a great feature for players and fans who want to browse media from previous games. All photos that are added to the app are watermarked with the client’s logo and can be shared on social media channels like Facebook and Twitter. Watermarking the photos extends the client’s brand in an easy way through social media interaction. Uploading large images requires the use of an http request with multipart form data. This is how the web service knows where the image blob upload begins and ends. We leveraged the popular AFNetworking Objective-C library to take care of this.

 

Calendar

Another feature we created was one that allows you to find upcoming games with a built-in calendar. We found a module on CocoaControls called RDVCalendarView that takes care of the calendar UI. Since it was written in Objective-C, we used a bridging header to integrate it into the app. We also modified and extended the module to satisfy the app requirements.

 

fye2Swift-Bridging-Header.h

#import “RDVExampleDayCell.h”
#import “RDVCalendarDayCell.h”
#import “RDVCalendarView.h”
#import “RDVCalendarViewController.h”

@import UIKit;
@import Foundation;
@import SystemConfiguration;
@import MobileCoreServices;

#import <Quickblox/Quickblox.h>
#import “AFNetworking.h”

 

FYE.Swift Pic

 

Embrace Change

There may be concern that Swift is new and doesn’t yet have a rich ecosystem of modules and SDKs, but Swift actually has access to the same vast library of code available to Objective-C. Just use a simple bridging header and you have access to your Objective-C code from Swift.