Skip to content

Instantly share code, notes, and snippets.

View denisoliveira's full-sized avatar

Denis Oliveira denisoliveira

View GitHub Profile
@denisoliveira
denisoliveira / GradientHelper.swift
Created June 27, 2017 14:45
Gradient Directions
class GradientHelper {
/// Set gradient background on view use this method on *draw(_ rect:* **CGRect...***)*
///
/// - Parameter colours: A grandient colors args
func setGradientBackground(angle: CGFloat = 0, colours: CGColor...) {
let colours = colours as CFArray
let context = UIGraphicsGetCurrentContext()
let gradient = CGGradient(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: colours, locations: nil)!
// Make the right degree
extension UILabel {
func letterSpacing(spacing: CGFloat) {
guard let text = self.text else {
return
}
var attributedText: NSMutableAttributedString?
if self.attributedText == nil {
attributedText = NSMutableAttributedString(string: text)
}
@denisoliveira
denisoliveira / ViewController.swift
Created April 20, 2017 02:11
Animated item on screen
//
// ViewController.swift
// IntroAnimation
//
// Created by Denis Oliveira on 4/19/17.
// Copyright © 2017 Denis Oliveira. All rights reserved.
//
import UIKit