Skip to content

Instantly share code, notes, and snippets.

kvaDrug

Block or report user

Report or block kvaDrug

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kvaDrug
kvaDrug / Minimalistic (iOS).joboptions
Created Sep 10, 2019
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.
View Minimalistic (iOS).joboptions
<<
/ASCII85EncodePages false
/AllowPSXObjects false
/AllowTransparency true
/AlwaysEmbed [
true
]
/AntiAliasColorImages false
/AntiAliasGrayImages false
/AntiAliasMonoImages false
@kvaDrug
kvaDrug / JSONHelpers.swift
Created Feb 20, 2019
A robust way to create JSON objects from JSONSerialization.
View JSONHelpers.swift
//
// 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:
http://kelindev.blogspot.com/2018/01/safer-parsing-with-jsonserialization-in.html
*/
@kvaDrug
kvaDrug / Unwrap.swift
Created Feb 20, 2019
Unwraps an optional and throws error if nil. The related blogpost: https://kelindev.blogspot.com/2018/01/catching-nil-as-error.html.
View Unwrap.swift
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
kvaDrug / StoryboardInstantiatableViewController.swift
Created Feb 20, 2019
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
View StoryboardInstantiatableViewController.swift
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: https://kelindev.blogspot.com/2018/10/uikit-protocol-of-month.html
*/
protocol StoryboardInstantiatableViewController {
static var storyboardId: String { get }
You can’t perform that action at this time.