Una vez modificado un archivo, podemos ver los cambios con:
git diff
| { | |
| "firstName": "Name", | |
| "lastName": "LastName", | |
| "age": 10, | |
| "address": | |
| { | |
| "streetAddress": "Reforma", | |
| "city": "Mexico", | |
| "state": "CDMX", | |
| "postalCode": "00600" |
| { | |
| "data" : "some data" | |
| } |
| #!/bin/bash | |
| # cd /usr/local/bin | |
| echo "Clearing Derived Data" | |
| rm -rf /Users/<MyUserName>/Library/Developer/Xcode/DerivedData | |
| echo "Done" |
| import UIKit | |
| class ImageDownloader { | |
| // DOWNLOAD IMAGE METHOD | |
| func loadImage(of from: URL, completion: @escaping () -> Void ) -> UIImage { | |
| let size = CGSize(width: 100, height: 140) | |
| // Download and Compress image to fit container size | |
| DispatchQueue.global(qos: .background).async { | |
| guard let newimage = self.downloadAndCompress(url: url, newSize: size) else { return } |
| // | |
| /* | |
| In iOS, Apple provides two ways to do multitasking: | |
| The Grand Central Dispatch (GCD) and NSOperationQueue frameworks. | |
| Both of them work perfectly when it’s time to assign tasks to different threads, or different queues other than the main one. | |
| Which one should be use is a subjective matter, but in this tutorial we’ll focus on the first one, the GCD. | |
| *No matter what,there’s one rule that should be always respected: | |
| The main thread must be always remain free so it serves the user interface and user interactions. |
| import UIKit | |
| /* | |
| What: | |
| A protocol that defines the action we want to encapsulate. | |
| Who: | |
| An object who contains an object who conforms the strategy. | |
| How: |
| import UIKit | |
| // Creamos un Protocolo | |
| protocol Beverage { | |
| func brewed() -> Self | |
| } | |
| //Creamos una funcion Generic donde el tipo T conforma al Protocolo | |
| func serve<T>(_ drink: T) -> T where T: Beverage { | |
| print("Se ejecuto metodo del generic \(drink.self)") |
| protocol Observer { | |
| func update() | |
| } | |
| class ConcreteObserver: Observer { | |
| var id: String | |
| init(id: String) { | |
| self.id = id | |
| } | |
| func update() { |