- Proposal: SE-NNNN
- Authors: Amir-Abbas Mousavian
- Review Manager: TBD
- Implementation: TBD
- Status: Pending Review
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
// | |
// RedisValueHelper.swift | |
// | |
// | |
// Created by Amir Abbas Mousavian on 01/01/2020. | |
// | |
import Foundation | |
import Vapor | |
import NIO |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>iPhone5,1</key> | |
<string>iPhone 5 (GSM)</string> | |
<key>iPhone5,2</key> | |
<string>iPhone 5 (GSM+CDMA)</string> | |
<key>iPhone5,3</key> | |
<string>iPhone 5C (GSM)</string> |
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
extension UIViewController { | |
enum LayoutGuide { | |
case none | |
case layoutMargin | |
case readableContent | |
case safeArea | |
} | |
func embed(_ viewController: UIViewController, into: UIView? = nil, inset: UIEdgeInsets = .zero, edges: UIRectEdge = .all, | |
guide: UILayoutGuide? = nil, priorities: UIView.EdgePriorities = .init()) { |
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
struct Bill: Codable { | |
let b: String | |
let c: String | |
} | |
struct B2: Codable { | |
enum CodingKeys: String, CodingKey { case a } | |
let bill: Bill | |
let a: Int | |
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
extension NSCoder { | |
func encode<T: RawRepresentable>(_ object: Any?, forKey key: T) where T.RawValue == String { | |
switch object { | |
case let object as Bool: | |
encode(object, forKey: key.rawValue) | |
case let object as Int32: | |
encode(object, forKey: key.rawValue) | |
case let object as Int64: | |
encode(object, forKey: key.rawValue) | |
case let object as Float: |
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
/// Add these lines to your app bridging header | |
#import <OneSignal/OneSignal.h> | |
#import "OneSignalTweak.h" |
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
protocol A { | |
func foo() -> Int | |
} | |
extension A { | |
func foo() -> Int { | |
return 10 | |
} | |
} |
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
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { | |
if let response = task.response as? HTTPURLResponse, response.statusCode >= 400 { | |
return | |
} | |
// Workaround a CFNetwork bug which cause a write posix error. | |
// Invalidates session and start tasks again. | |
if let error = error as? POSIXError, error.code == .ENOENT { | |
session.invalidateAndCancel() | |
return |
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
extension String { | |
private func regionalIndicatorSymbol(unicodeScalar: UnicodeScalar) -> UnicodeScalar? { | |
let uppercaseA = UnicodeScalar("A")! | |
let regionalIndicatorSymbolA = UnicodeScalar("\u{1f1e6}")! | |
let distance = unicodeScalar.value - uppercaseA.value | |
return UnicodeScalar(regionalIndicatorSymbolA.value + distance) | |
} | |
public var emojiFlag: String { | |
return self.uppercased().unicodeScalars.map({ |
NewerOlder