For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
indirect enum LinkedListNode { | |
case head(value: Int, node: LinkedListNode) | |
case node(value: Int, next: LinkedListNode) | |
case tail(value: Int) | |
} | |
let linkedList = LinkedListNode | |
.head(value: 0, node: | |
.node(value: 1, next: | |
.node(value: 2, next: |
One file for each domain, both www.example.com and example.com need separate files:
{
"applinks": {
"apps": [],
"details": {
"9JA89QQLNQ.com.apple.wwdc": {
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import LocalAuthentication | |
class BiometricAuth { | |
var context = LAContext() | |
var error: NSError? | |
func auth(_ completion: @escaping (_ success: Bool) -> ()) { | |
// Get the supported biometry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RealmSwift | |
extension Results { | |
func toArray() -> [T] { | |
return self.map{ $0 } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RealmSwift | |
internal struct RealmService { | |
private static var realm: Realm? { | |
do { | |
return try Realm() | |
} catch let error as NSError { | |
print(error) | |
return nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIColor { | |
/// Creates image from color | |
/// - Parameter size: size of returned image | |
/// - Returns: UIImage | |
func image(_ size: CGSize = CGSize(width: 1, height: 1)) -> UIImage { | |
return UIGraphicsImageRenderer(size: size).image { rendererContext in | |
self.setFill() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public extension Date { | |
// MARK: - Convert from String | |
/* | |
Creates a new Date based on a string of a specified format. Supports optional timezone and locale. | |
*/ | |
init?(fromString string: String, format: DateFormatType, timeZone: TimeZoneType = .local, locale: Locale = Foundation.Locale.current, isLenient: Bool = true) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import CoreText | |
import XCPlayground | |
let font = UIFont(name: "HelveticaNeue", size: 46)! // Choose font | |
var allPathes = [CGPath]() | |
var unichars = [UniChar]("i".utf16) //Insert text | |
var glyphs = [CGGlyph](repeating: 0, count: unichars.count) | |
let gotGlyphs = CTFontGetGlyphsForCharacters(font, &unichars, &glyphs, unichars.count) |