Skip to content

Instantly share code, notes, and snippets.

kvaDrug / Minimalistic (iOS).joboptions
Created September 10, 2019 08:42
Adobe Illustrator preset for exporting lightweight PDF files intended for use with Xcode as vector icons. Put it to /Users/Username/Library/Application Support/Adobe/Adobe PDF/Settings.
/ASCII85EncodePages false
/AllowPSXObjects false
/AllowTransparency true
/AlwaysEmbed [
/AntiAliasColorImages false
/AntiAliasGrayImages false
/AntiAliasMonoImages false
kvaDrug / JSONHelpers.swift
Created February 20, 2019 21:47
A robust way to create JSON objects from JSONSerialization.
// Created by Vladimir Kelin on 2/8/19.
// Copyright © 2019 Systematix Infotech. All rights reserved.
A more robust way to create JSON objects from JSONSerialization.
Why more robust? See the explanation:
kvaDrug / Unwrap.swift
Created February 20, 2019 21:43
Unwraps an optional and throws error if nil. The related blogpost:
func unwrap<T>(_ optional: T?) throws -> T {
if let real = optional {
return real
} else {
throw UnwrapError(optional: optional)
struct UnwrapError<T>: Error, CustomStringConvertible {
let optional: T?
kvaDrug / StoryboardInstantiatableViewController.swift
Created February 20, 2019 21:37
A Swift protocol allowing to 1) shorten the code required to instantiate an UIViewController from a storyboard 2) store the storyboard id in the predictable place
import UIKit
This protocol along with the extension provides some syntactic sugar and solves two common problems:
- Shortens the instantiation
- Answers, where to store the storyboard id
Blog post:
protocol StoryboardInstantiatableViewController {
static var storyboardId: String { get }