Skip to content

Instantly share code, notes, and snippets.

@lukagabric
lukagabric / VersionsComparison.playground
Last active November 21, 2017 08:14
Comparing version strings
import UIKit
import Foundation
func compareVersions(version1: String, version2: String) -> ComparisonResult {
let version1Components = version1.components(separatedBy: ".")
let version2Components = version2.components(separatedBy: ".")
let length = max(version1Components.count, version2Components.count)
for i in 0 ..< length {
@lukagabric
lukagabric / Appboy Rich Notifications Swift
Last active July 15, 2017 19:09
Appboy iOS 10 Rich Notifications Service Extension written in Swift
//
// NotificationService.swift
//
// Created by Luka Gabric on 12/04/2017.
// Copyright © 2017 Luka Gabric. All rights reserved.
//
import UserNotifications
import NotificationServiceExtensionCommon
@lukagabric
lukagabric / SwiftSetterTest.playground
Created January 28, 2017 13:25
Difference in value and reference type property setters
public struct MyValueType {
public var name: String = "My name"
mutating func update(name newName: String) {
name = newName
}
}