Tag Archives: swift

Apple introduces CoreML − Machine Learning Framework

On June 2017 in an opening keynote of WWDC in California, Apple introduced CoreML − machine learning framework that is designed to help developer build amazing user experiences.

Two main parts of this framework are Vision and NLP (Natural Language Processing).

Vision allows you to integrate machine learning features into your applications, like:  face tracking, face detection, landmarks, text detection, rectangle detection, barcode detection, object tracking, and image registration.

Where is NLP focused on: language identification, tokenization, lemmatization, part of speech, and named entity recognition.

This is a very big step forward for a developers. Giving this set of tools and API's will allow us in the next 5 months build and bring new category of applications into customers smartphones by the time new iPhone 8 (?) and iOS11 will be delivered by Apple.

Just as an example, imagine an application, that will allow you to point your camera onto a dog, flower, tree, piece of furniture, etc and get full information about it: name, breed, classification, price and so much more.

Considering this exciting news I've created example application and custom Image Recognizer class written in Swift that takes user provided picture, process it and returns name of the object and confidence number (from 0-100%). See example screenshot below.

apple coreml vision application exampleFull github example of the working application project can be found here.

1,943 total views, 2 views today

App: Watch Recorder — One Tap Audio Capturing


I've been an owner of an Apple Watch for almost a year now. Until recently, I never thought about using it as a audio recorder, in fact I never even actually though it's possible. But then I got this idea of how cool if would be to have a full portable recorder on your wrist. Kind of like almost being a spy (always dream of being one). At first I even wanted to call my app as "Watch Spy Recorder," but then I decided to stick with just Watch Recorder.

1. Research

First thing you do when you got an app idea — you research. Sure enough there are plenty of apps that can record audio from your Apple Watch microphone, but big ammount of them are not working (I assume due to watchOS 2.2 update, which simply broke audio recording), so there is a good market for an app with a good user interface and good sharing capabilities. Let's do this!

2. Bussines plan

Application is distributed for free, but will include in-app purchase of Premium version with extended capabilities. See screenshot below for differences between Free and Premium vesions of an application:


3. Making an Apple Watch app

Main part of an application is going to be an Apple Watch extension. Without actual physical Apple Watch device, connected iPhone app is not going to function (unless Watch was previously connected and some audio recorded).

Main screen of application is consist of timer that's shows time of previous recordin, settings labels that shows user what currect audio settings he has and four action buttons around it: record, settings, info and list of recordings. "Play" button will appear once user record an audio. Nice feature that user can use, is actually option to hide action buttons in the settings, but still have access to them using Force Touch.

Watch Recorder – main screen
Watch Recorder – hidden action buttons
Watch Recorder – Force Touch action buttons

Continue reading App: Watch Recorder — One Tap Audio Capturing

2,975 total views, 3 views today

How to easy document your swift code with Jazzy

This is quick and very basic guide on how to install and use awesome open-source project called Jazzy that may help you to create html, Apple-style like documentation for your code.

Before even proceeding to installation make sure you document your code appropriate, for example:

     Function to get formatted time
     - parameter interval: NSTimeInterval value
     - returns: NSString of formatted time
    func stringFromTimeInterval(interval:NSTimeInterval) -> NSString {
        let ti = NSInteger(interval)
        let ms = Int((interval % 1) * 1000)
        let seconds = ti % 60
        let minutes = (ti / 60) % 60
        let hours = (ti / 3600)
        return NSString(format: "%0.2d:%0.2d:%0.2d.%0.3d",hours,minutes,seconds,ms)

So, if you have done a good job of documenting your code you probably thinking on how to export all your commenting into HTML pages?

Well, there is very simple way:

  1. Open terminal (cmnd+space)
  2. Run next command: sudo gem install jazzy
  3. Enter your user password and wait till it's done installing files
  4. Navigate to your project folder, with command cd, for example: cd [your-folder]/ [sub-folder]/ [your-project-folder]
  5. Run command: jazzy
  6. Profit!

By default jazzy only documents public declarations. So, if running just jazzy command does not produce any meaningful documentation, expand it with next:

jazzy --min-acl internal
jazzy --min-acl private

Produced html pages can be found in your project /docs folder and will look something like this:


Hope this basic step-by-step helps!


Swift Documentation


1,889 total views, 2 views today

App: Simple Magic Ball


It's been not so long time ago due to not being American I discovered a fortune-telling toy called Magic 8-Ball. Nothing special, just a plastic ball with a special shaped 20-sided object inside called Icosahedron floating in colored alcohol. Each side of it contains an answer: 10 positive, 5 neutral and 5 negative. Workflow of using it is next: ask a question, shake a ball and get one of the answers shown to you. Fascinating.

magic-8-ball magic-8-ball-answer

1. Research

So, I got this "cool" idea of creating an mobile app for it. Well I thought it was cool, until I actually decided to research a bit and see if there any other applications that already in a market. And sure there where many of them. So I decided to install bunch of them and see how they work. And this was the point I got really excited: none of the applications where working the way I expected them to work. Major flaws are basically overcomplicated functionality: to many taps and to much animation involved before user actually get an answer. I basically wanted to delete them all after I tried to play for a minute. And this is where I saw some opportunity.

I asked myself a question: why such a simple game is being so much complicated on a user interface? Why can't I as a user just shake my phone and get and answer, shake it again and yet get a new answer almost instantly – the same way actual Magic Ball works? And I decided to make actually a Simple Magic Ball.

Simple first app as a iOS developer, simple user interface, simple yet beautiful animation and happy users in the end.


Continue reading App: Simple Magic Ball

3,236 total views, 3 views today

Fullscreen activityIndicator with Swift 2.3

fullscreen activityIndicator with semi-transparent background
fullscreen activityIndicator with semi-transparent background

Here is a code snippet for those who have been looking for simple solution on how to make fullscreen activityIndicator with Swift.

First, inside of yourt UIViewController create variable to hold activityIndicator:

var activityIndicator: UIActivityIndicatorView = UIActivityIndicatorView()

Then add this two methods to start and stop activityIndicator when your application required:

    func startActivityIndicator() {
        let screenSize: CGRect = UIScreen.mainScreen().bounds
        activityIndicator = UIActivityIndicatorView(frame: CGRectMake(0, 0, 50, 50))
        activityIndicator.frame = CGRectMake(0, 0, screenSize.width, screenSize.height)
        activityIndicator.center = self.view.center
        activityIndicator.hidesWhenStopped = true
        activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.White
        // Change background color and alpha channel here
        activityIndicator.backgroundColor = UIColor.blackColor()
        activityIndicator.clipsToBounds = true
        activityIndicator.alpha = 0.5
    func stopActivityIndicator() {

Hope it helps!

3,100 total views, 4 views today