Skip to content

Instantly share code, notes, and snippets.

View sssbohdan's full-sized avatar
❤️

Bohdan Savych sssbohdan

❤️
View GitHub Profile
@sssbohdan
sssbohdan / contact.m
Created December 14, 2016 11:41 — forked from willthink/contact.m
Using CNContactStore in Objective C to query contacts info
#import <Contacts/Contacts.h>
@implementation ContactsScan
- (void) contactScan
{
if ([CNContactStore class]) {
//ios9 or later
CNEntityType entityType = CNEntityTypeContacts;
if( [CNContactStore authorizationStatusForEntityType:entityType] == CNAuthorizationStatusNotDetermined)
@sssbohdan
sssbohdan / iOS.8.3.txt
Created March 13, 2017 12:43
iOS UIFont names
UIFont: family Thonburi
UIFont: font Thonburi-Bold
UIFont: font Thonburi
UIFont: font Thonburi-Light
UIFont: family Khmer Sangam MN
UIFont: font KhmerSangamMN
UIFont: family Snell Roundhand
UIFont: font SnellRoundhand-Black
UIFont: font SnellRoundhand-Bold
UIFont: font SnellRoundhand
@sssbohdan
sssbohdan / WorldSideEnum.swift
Last active May 25, 2017 14:35
WorldSideEnum
//
// WorldSide.swift
//
//
// Created by Bohdan Savych on 5/16/17.
// Copyright © 2017 Bohdan Savych. All rights reserved.
//
import UIKit
@sssbohdan
sssbohdan / ImagePickerPresenter.swift
Created May 25, 2017 14:34
ImagePickerPresenter
//
// ImagePickerPresenter.swift
//
//
// Created by Bohdan Savych on 5/25/17.
// Copyright © 2017 perpetio. All rights reserved.
//
import UIKit
static func getAspectFillMultiplier(originalSize: CGSize, desirableSize: CGSize) -> CGFloat {
let heightDiff = desirableSize.height - originalSize.height
let widthDiff = desirableSize.width - originalSize.width
var multiplier: CGFloat!
if abs(heightDiff) > abs(widthDiff) {
multiplier = 1 + heightDiff / originalSize.height
} else {
multiplier = 1 + widthDiff / originalSize.width
}
func addShadow(color: UIColor, fillColor: UIColor, radius: CGFloat = 3, opacity: Float = 0.5, offset: CGSize, cornerRadius: CGFloat = 0) {
let shadowLayer = CAShapeLayer()
shadowLayer.path = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius).cgPath
shadowLayer.shadowColor = color.cgColor
shadowLayer.shadowPath = shadowLayer.path
shadowLayer.shadowOffset = offset
shadowLayer.shadowOpacity = opacity
shadowLayer.shadowRadius = radius
shadowLayer.masksToBounds = false
shadowLayer.fillColor = fillColor.cgColor
@sssbohdan
sssbohdan / CovarianceContravariance.swift
Created June 22, 2017 20:41 — forked from pedrocid/CovarianceContravariance.swift
Examples os covariance and contravariance in Swift
//MARK: From https://mikeash.com/pyblog/friday-qa-2015-11-20-covariance-and-contravariance.html
import UIKit
//MARK: TYPE VARIANCE LESSON
//First we explore supertypes and subtypes
class Thing {}
class Vehicle: Thing {}
@sssbohdan
sssbohdan / introrx.md
Created June 24, 2017 19:53 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@sssbohdan
sssbohdan / DateFormatterHelper.swift
Last active August 18, 2017 14:02
DateFormatterHelper
//
// DateFormatterHelper.swift
// Rolique
//
// Created by Bohdan Savych on 8/18/17.
// Copyright © 2017 Rolique. All rights reserved.
//
import UIKit
import UIKit
import RxSwift
import RxCocoa
let requiredUserNameLength = 5
let requiredPasswordLength = 5
let limitUserNameLength = 20
class ValidationViewController: UIViewController {