Target platform condition
- Proposal: SE-NNNN
- Authors: Amir-Abbas Mousavian
- Review Manager: TBD
- Implementation: TBD
- Status: Pending Review
// | |
// RedisValueHelper.swift | |
// | |
// | |
// Created by Amir Abbas Mousavian on 01/01/2020. | |
// | |
import Foundation | |
import Vapor | |
import NIO |
<?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> |
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()) { |
struct Bill: Codable { | |
let b: String | |
let c: String | |
} | |
struct B2: Codable { | |
enum CodingKeys: String, CodingKey { case a } | |
let bill: Bill | |
let a: Int | |
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: |
/// Add these lines to your app bridging header | |
#import <OneSignal/OneSignal.h> | |
#import "OneSignalTweak.h" |
protocol A { | |
func foo() -> Int | |
} | |
extension A { | |
func foo() -> Int { | |
return 10 | |
} | |
} |
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 |
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({ |