I hereby claim:
- I am achase55 on github.
- I am achase (https://keybase.io/achase) on keybase.
- I have a public key ASBaMNAosgYvs_nf0BLeiB9kEk4a3oNUrpVmzx2fgUhNlgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| //Cleanly instantiate UIColors using 1 or 3 Int, Double, Float, or CGFloat Values | |
| //UIColor convience initializer UIColor(4, 20, 69) | |
| //UIColor convience initializer for gray(all three values the same) UIColor(69) | |
| //Instantiate gray from a number: 210.rgbTriple() | |
| //Instantiate color from an array of numbers:[40, 33, 60].rgbColor() | |
| //Optionally express an alpha value | |
| //UIColor(4, 20, 69, 0.4) |
| #if defined(TARGET_IOS) || defined(TARGET_TVOS) | |
| @import UIKit; | |
| #define PlatformViewController UIViewController | |
| #else | |
| @import AppKit; | |
| #define PlatformViewController NSViewController | |
| #endif | |
| // Our view controller | |
| @interface MyViewController : PlatformViewController |
| import Foundation | |
| class AsyncOperation: Operation { | |
| private var _isFinished: Bool = false | |
| private var _isExecuting: Bool = false | |
| open func execute() { assertionFailure("Overide execute() in subclass") } | |
| override var isAsynchronous: Bool { return true } |
| #define RANDOM_COLOR [[UIColor alloc] initWithRed:arc4random()%256/256.0 green:arc4random()%256/256.0 blue:arc4random()%256/256.0 alpha:1.0] |
| #import <UIKit/UIKit.h> | |
| NS_ASSUME_NONNULL_BEGIN | |
| @interface RoundedCornerView : UIView | |
| @property (nonatomic) IBInspectable CGFloat cornerRadius; | |
| @end | |
| NS_ASSUME_NONNULL_END |
| import Foundation | |
| import Alamofire | |
| import AlamofireImage | |
| extension UIImageView { | |
| func loadImage(_ url:String?) { | |
| guard let url = url else { return } | |
| Alamofire.request(url).responseImage {[weak self] response in | |
| guard let self = self else { return } | |
| if let image = response.result.value { |
| //Trying out a prefix operator | |
| //I thought vertical elipses made sense, representative of rbg | |
| prefix operator ⋮ | |
| prefix func ⋮(hex:UInt32) -> Color { | |
| return Color(hex) | |
| } | |
| extension Color { | |
| init(_ hex: UInt32, opacity:Double = 1.0) { | |
| let red = Double((hex & 0xff0000) >> 16) / 255.0 |
| import SwiftUI | |
| extension View { | |
| public func offset(_ offset: CGPoint) -> Self.Modified<_OffsetEffect> { | |
| self.offset(x: offset.x, y: offset.y) | |
| } | |
| } | |
| struct ContentView : View { | |
| import SwiftUI | |
| extension View { | |
| public func offset(_ offset: CGPoint) -> Self.Modified<_OffsetEffect> { | |
| self.offset(x: offset.x, y: offset.y) | |
| } | |
| } | |
| struct ContentView : View { | |
| @State var location: Double = 0 |