See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
| func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { | |
| guard let serverTrust = challenge.protectionSpace.serverTrust else { | |
| completionHandler(.cancelAuthenticationChallenge, nil); | |
| return | |
| } | |
| let certificate = SecTrustGetCertificateAtIndex(serverTrust, 0) | |
| // SSL Policies for domain name check | |
| let policy = NSMutableArray() |
| struct Foo: Codable { | |
| var name: String | |
| @Ignore var foo: Int? | |
| } | |
| let model = Foo(name: "Ian", foo: 42) | |
| let data = try! JSONEncoder().encode(model) | |
| print(String(data: data, encoding: .utf8)!) // {"name":"Ian"} | |
| // How to: | |
| // 1. Open the Firebase Analytics Dashboard | |
| // 2. Scroll to bottom, where you see the "Users by Device model" widget | |
| // 3. Click "View device models" in that widget (this opens the "Tech details" Firebase Analytics page) | |
| // 4. Above the table shown in the new page, click on the “Device model” drop down menu and select “OS with Version” | |
| // 5. Make sure to select “OS with version” and not “OS Version” | |
| // 6. On the top right corner of the page, click on the “Share this report” icon (next to the date) | |
| // 7. Click “Download file” on the new side bar, then “Download CSV" | |
| // 8. Open the file and select the iOS/Android breakdown raw data | |
| // 9. Replace the sample data in this script with your data |
| class AppDelegate: UIResponder, UIApplicationDelegate { | |
| var window: UIWindow? | |
| func applicationWillResignActive(_ application: UIApplication) { | |
| addBlurViews() | |
| } | |
| func applicationDidBecomeActive(_ application: UIApplication) { | |
| removeBlurViews() | |
| } |
| import Foundation | |
| enum VersionError: Error { | |
| case invalidResponse, invalidBundleInfo | |
| } | |
| class ForceUpdateAppVersion { | |
| class func isForceUpdateRequire(apiVersion:Int) -> Bool { | |
| func update() { |
| // MARK:- definition | |
| /// Constraint for Parameter Type Definition. | |
| protocol ParameterProtocol { | |
| /// Parameter name in Firebase console. e.g. "beta_test_1" | |
| var name: String { get } | |
| /// Default value to be set to Remote Config object. | |
| var defaultValue: [String: NSObject] { get } | |
| } |
| // https://stackoverflow.com/questions/30757193/find-out-if-character-in-string-is-emoji | |
| import Foundation | |
| extension UnicodeScalar { | |
| var isEmoji: Bool { | |
| switch value { | |
| case 0x1F600...0x1F64F, // Emoticons | |
| 0x1F300...0x1F5FF, // Misc Symbols and Pictographs | |
| 0x1F680...0x1F6FF, // Transport and Map | |
| 0x1F1E6...0x1F1FF, // Regional country flags |
| extension String { | |
| func getRawVersionString() -> String? { | |
| return self.removePrefix("v") | |
| .split(separator: "-") | |
| .first?.toString() | |
| } | |
| // Modified from the DragonCherry extension - https://github.com/DragonCherry/VersionCompare | |
| private func compare(toVersion targetVersion: String) -> ComparisonResult { | |
| let versionDelimiter = "." |
| // | |
| // AttachmentHandler.swift | |
| // AttachmentHandler | |
| // | |
| // Created by Deepak on 25/01/18. | |
| // Copyright © 2018 Deepak. All rights reserved. | |
| // | |
| import Foundation | |
| import UIKit |