There is an amazing project called Swift Package Manager. I hope you know about it, if not take a second and have a look on it :)

Overview

Swift Package Manager (short name SwiftPM) is a dependency manger. You can make a Manifest file and declare your dependencies there.

import PackageDescription

let package = Package(
name: "Hello",
dependencies: [
.Package(url: "ssh://git@example.com/Greeter.git",
versions: Version(1,0,0)..<Version(2,0,0)),
]
)

In this example I simply say that my Package with name “Hello” depends on package with:

  • Url - ssh://git@example.com/Greeter.git

That is the most popular notation to specify your dependency version. …


So, 2015 is over, only few hours left. I feel the celebration and party in the air. But I want to take some time to sum it up. It was incredible year for me, I achieved many goals and dreams and I feel I become better person than I was a year ago. I’m thankful for all the experiences I had and Huge Huge thanks to the people I spend time with.

I want to share my 2015 year with you and I hope you could find some inspiration and tips that could help you make 2016 Great year and…


First let’s have a look at one of my favourite Swift features, code optimisation.

Swift Optimisation

Swift compiler is very smart. The code the compiler emits will omit unnecessary operations, for example:

  • Unused variables

For example lets have a look on this code and compile it with Optimization enabled and without

Here are results: Left -Ounchecked, Right -Onone


“Knowing is not enough, we must apply” -Bruce Lee

Pre History

Finally I’ve read the “Start with WHY” book and I really like it. The most important part in reading books is applying what you have read. Sometimes it’s hard to apply all the ideas from the book in your current situation and it happened to me with the “Start with WHY” book, because I’m not the CEO “yet” :) and I can’t apply all of them. To practice the knowledge from the book I’ve decided to do other thing that helps to master the topic — to teach others. …


I’m very interested in discovering Swift performance and I wrote few blogs about it. I get really interested in comparing C vs Swift after reading Jesse Squires’s article.

Swift vs C

I wanted to compare the most trivial task in Swift and C — for loop

C

Swift

Results: (in release mode of course)

C: 0.000002 sec
Swift: 0.0928 sec

Wow that was fast in C! Hold on a second. It seems like C does some powerful optimisation and doesn’t do any actual calculation in the loop, but calculates the result at compile time. …


I was doing some swift and accidentally I’ve spotted this functionality -

func sum(x: Int, y: Int) -> Int {
return x + y
}
let params = (1,1)
sum(params)

WAAAT!
It’s possible to pass a tuple instead of arguments list
I’ve read that this is possible in Haskell and Scala, but I thought it wasn’t possible in Swift 1.0

Let the Fun Begin!

Basically I’ve discovered that it’s possible to pass a Tuple instead of arguments to a function. I’d started playing with it and discovered that there are some cases when it’s not working. Here are my discoveries:

  • Function parameter type and…


AppInfo — Swift Api for InfoDictionary

This story began when I read a Radek’s article about Swifty APIs: NSUserDefaults

I really liked the idea of having static typed API and making things less verbose and more clean and clear. I looked around and found that there are dozens API in iOS that can be improved by applying that pattern. Here is my first project:
- NSBundle.infoDictionary Swift API

Pain

Let’s start with how was it before and why was it painful.

  1. Verbose

1. Verbose

To get a value for InfoDictionary we have to type this every time

NSBundle.mainBundle().infoDictionary?["KeyName"]


Part 2 — Look under the hood

Secret of Swift Performance

Part 1 — Measure

Look under the hood

When you want to analyze an app performance, definitely your best friend are — Instruments and Measure. I hope everyone knows Instrument and have used it at least once. Instruments provides great tools for giving you answer: “How much memory does my app use”, “How fast it”, “Is it leaking memory”, “How …” and etc.
But as an Software Engineer we also want to know “Why … ?”,
“Why it happens?”

When I worked with Swift, I saw interesting results I couldn’t understand. “Why this code is so fast?”…


Apple has released WatchKit and we can make apps Apple Watch.
Few steps to take:

  1. Dowload Xcode 6.2 with WatchKit SDK

Steps in Details

After you have dowloaded Xcode 6.2, first tasks is

Create a project

Create New Project >
iOS > Applications >
Single View Application

Add Watch Kit Target


Part 1 — Measure

Secret of Swift Performance

Measure

There were a lot of discussions about Swift performance.
Is it really faster than C? How can it be faster? What are the speed numbers? etc.

But as an app developer, we want to know how we can make our app faster in an easy way. What is the silver bullet we can easily use to speed up our app.

Identify slow area

It’s important to identify the slow parts of your app. As the 80/20 Rule says, “ about 20% of your app code takes up to 80% of run speed. It means that it’s important to find…

Kostiantyn Koval

iOS Dev. In love with iOS and Swift. “Swift High Performance” book author http://www.amazon.com/gp/product/B016BW45FQ

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store