Posts
- Get link
- X
- Other Apps
Popular Posts
escaping closure and closure
Closures are self-contained blocks of functionality that can be passed around and used in your code. let greeting:(String) -> () = { name in print("Hi, \(name)!") } birthday("Bebo") An escaping closure is a closure that’s called after the function it was passed to returns. In other words, it outlives the function it was passed to. A non-escaping closure is a closure that’s called within the function it was passed into, i.e. before it returns.
Certificate pinning and Alamofire
1. Alamofire and URLSession. both help you to make network requests in Swift. Main advantage for Alamofire: Certificate pinning . It can take some time to sort this out and build this yourself. Asymmetric cryptography : The second phase uses public-key cryptography or asymmetric cryptography . This is a cryptographic system that uses pairs of keys: Public keys, which are widely disseminated and private keys, which only the owner knows. The third phase uses symmetric-key cryptography , where you use the same key for both encryption of plaintext and decryption of ciphertext. In other words, you configure the app to reject all but one or a few predefined certificates or public keys. Whenever the app connects to a server, it compares the server certificate with the pinned certificate(s) or public key(s). If and only if they match, the app trusts the server and establishes the connection. You usually add a service’s certificate or public key a...