iOS Development

UIAlertController with UIImage

August 11, 2017
AlertViewController is UIAlerController subclass. It adds ability to display UIImage above the title label. Functionality is achieved by adding \n characters to title, to make space for UIImageView that is added as subview to UIAlertController.view. Set title as normal but when retrieving value use originalTitle property. It is a bit of a hack, yes. But works on iOS 9, 10 and latest iOS 11 (beta 5). I find it easier to maintain than trying to implemnet class that mimics behaviour of UIAlertController from scratch. Get is on GitHub. (more…)
#Blog posts, #Coding, #iOS Development, #Technology

MLCamera – Vision & Core ML with AVCaptureSession Inceptionv3 model

June 13, 2017
Goal of MLCamera demo is to demonstrates using of Vision and Core ML frameworks, to process AVCaptureVideoDataOutput and to perform image classification. Complete working demo can be dowloaded from github. Relevant WWDC session are Introduction to Core ML, Vision framework building on Core ML. Apple provides few models converted to its Core ML supported format here. Apple also provides tools to convert most popular machine learning model types to Core ML supported format. With that out of the way let’s get started. (more…)
#AI, #Blog posts, #Coding, #iOS Development, #Swift, #Technology

SnowGlobe.framework iOS Xmas easter egg, shake iPhone to make it snow

November 11, 2015
Update: Now updated to Swift 3 thanks to Ben Kreeger. I don’t see anything wrong with falling for spirit of the holiday season and getting bit cheesy. Last year I wrote SnowGlobe.framework. Its easy to use, open source iOS framework written in Swift. Now updated for swift 2.0 and added Jingle bells sound effect. It allows you to add delightful / cheesy Christmas easter egg to your awesome app for holiday season. When user shakes the device, your app “turns into a snow globe”. Leveraging CAEmitterLayer to create snow fall, snow globe like animation while device is shaken. I am a sucker for that kinda of thing ☺️. You can get it at github here. Or using CocoaPods (“SnowGlobe”) Read about how to integrate it in original post here. Watch how it works in few of my apps below You can now see in action in Memory game. Sadly both of these apps are still (more…)
#Blog posts, #Coding, #iOS Development, #Swift

Push / Pop modal SFSafariViewController (Hacking swipe from edge gesture)

October 11, 2015
In iOS 9 Apple introduced SFSafariViewController. In a nutshell it pretty much runs full Safari in your app. This is great as user gets all Keychain passwords, Safari extensions access, cookies, session data, etc. All of that done securely as the SFSafariViewController spins up a separate process, so that the app does not have access to SFSafariViewController’s content (More info here). That’s all great, however there is problem. Result of pushing SFSafariViewController in UINavigationsController is loss of default bar behaviour, which looks pretty bad. So really, only option is to present it modally. This has is own drawbacks. Apple has made unfortunate choice of placing the done button to top right corner. This makes it very difficult to dismiss when using the phone one handed. Although, I don’t really think positioning it anywhere else would solve the problem. Now standard swipe from the edge of the screen gesture really is the (more…)
#Blog posts, #Coding, #iOS Development, #Swift

Add iOS 9’s Quick Actions shortcut support in 15 minutes right now !

September 14, 2015
Apple introduced 3D touch (/force touch for iOS) functionality in iOS 9. API is divided into 3 parts. Quick actions, Peek and Pop, Pressure Sensitivity. This functionality will be available in iOS 9 at launch. Meaning you can already submit apps with support for it right now. I will only delve into Quick Action support which is most straight forward and no brainer. With a bit of luck it can all be done in 15 min. Let me however start by disclaimer, that at the time of writing of this article I have no way of testing any sample code as neither simulator in Xcode 7 nor 7.1 beta support 3D touch simulation and iPhone 6s is still over a week away. I will update this post as soon as I’m able to actually test it. If you’d like to hear about update, you can follow me here @stringCode. Without further (more…)
#Blog posts, #Coding, #iOS Development, #Swift

Rendering version number into beta app icon using swift script

August 28, 2015
It’s quite handy to have multiple builds of same app on one device for developing purposes. I usually setup three different builds. I like to have AppStore version alongside βeta version that is distributed to testers, as well as having separate debug builds. Last is only used when I directly build and run from Xcode. I described my setup in blog post here. That blog post it’s a prerequisite for following technique of rendering app version and build number onto icon described below. All of the code is written in Swift 2.0 and sample project is Xcode 7.0 beta 6 project. Start by downloading icon_processor.swift. You may want to download whole sample project (make sure you are viewing icon_version_rendering branch). It will make following along easier. Copy icon_processor.swift to your project folder. Add new Run script build phase in iOS target just under target dependencies in Build Phases tab. Define a path to (more…)
#Blog posts, #Coding, #iOS Development, #Swift

Adding Weibo sharing option to your app (How and Why to China)

August 16, 2015
According to TechCrunch article Apple’s App Store saw $1.7B in billings transaction in July 2015 alone. To date, the company has paid out $33 billion to App Store developers, it said – $8 billion of which was in 2015 alone. Large chunk of growth has come from China. In fact China has overtaken U.S as number one source of downloads. And its now number three country by revenue.
This explained my continuos puzzlement by downloads stats for Memory Game. I though it was some sort of outlier, or possibly due to the popularity of Apple Watch in China. Not so. China truly is market not to be ignored. Business model for this particular game is first two levels are for free, then £0.79 (tier 1) to unlock all levels. Alternatively you can share on social media to unlock level three for free. My (more…)
#Blog posts, #Coding, #iOS Development, #Technology, #Uncategorized