Skip to content

Instantly share code, notes, and snippets.

View zabolotiny's full-sized avatar

Yuriy Zabolotin zabolotiny

View GitHub Profile
//Visit my blog http://scripttes.blogspot.com/
//IOS Template https://codecanyon.net/item/simple-qr-code-barcode-scanner-generate-ios-12-and-13/25018066
import Foundation
import UIKit
extension UIView {
func setGradientBackground(colorOne: UIColor, colorTwo: UIColor) {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds
@zabolotiny
zabolotiny / UIImage+Scale.m
Created June 10, 2020 11:40 — forked from tomasbasham/UIImage+Scale.m
Scale a UIImage to any given rect keeping the aspect ratio
@implementation UIImage (scale)
/**
* Scales an image to fit within a bounds with a size governed by
* the passed size. Also keeps the aspect ratio.
*
* Switch MIN to MAX for aspect fill instead of fit.
*
* @param newSize the size of the bounds the image must fit within.
* @return a new scaled image.
@zabolotiny
zabolotiny / CrashlyticsSwift.Swift
Created July 26, 2017 17:10 — forked from DimaVartanian/CrashlyticsSwift.Swift
Crashlytics CLS_LOG() in Swift
//
// Created by Dima Vartanian on 10/29/15.
//
import Foundation
import Crashlytics
// this method gives us pretty much the same functionality as the CLS_LOG macro, but written as a Swift function, the only differences are that we have to use array syntax for the argument list and that we don't get see if the method being called is a class method or an instance method. We also have to define the DEBUG compiler flag with -D DEBUG.
/// Usage:
///