This file contains hidden or 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
| import UIKit | |
| import Foundation | |
| func loadData() { | |
| do { | |
| guard let url = URL(string: "https://reqres.in/api/users/1") else { return } | |
| var request = URLRequest(url: url) | |
| request.httpMethod = "DELETE" | |
This file contains hidden or 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
| import UIKit | |
| func loadData() { | |
| do { | |
| guard let url = URL(string: "https://reqres.in/api/users") else { return } | |
| let body = [ | |
| "name": "Henry", | |
| "job": "Engineer" | |
| ] | |
This file contains hidden or 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
| import UIKit | |
| func loadData() { | |
| guard let url = URL(string: "https://reqres.in/api/users") else { return } | |
| URLSession.shared.dataTask(with: url) { (data, response, error) in | |
| if let error = error { | |
| print("Something went wrong with the request: \(error.localizedDescription)") | |
| return | |
| } |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <title> | |
| Learning HTML | |
| </title> | |
| <style> | |
| body { |
This file contains hidden or 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
| // | |
| // Order.swift | |
| // Project05_Cupcakes | |
| // | |
| // Created by jc on 2020-08-13. | |
| // Copyright © 2020 jc. All rights reserved. | |
| // | |
| import Foundation |
This file contains hidden or 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
| import UIKit | |
| let url = URL(string: "https://reqres.in/api/users/2")! | |
| URLSession.shared.dataTask(with: url) { (data, response, error) in | |
| if error != nil { | |
| print("Request failed with error: \(error?.localizedDescription)") | |
| return | |
| } | |
This file contains hidden or 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
| import UIKit | |
| let url = URL(string: "https://reqres.in/api/users/2")! | |
| URLSession.shared.dataTask(with: url) { (data, response, error) in | |
| if error != nil { | |
| print("Request failed with error: \(error?.localizedDescription)") | |
| return | |
| } | |
This file contains hidden or 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
| import UIKit | |
| let url = URL(string: "https://reqres.in/api/users/2")! | |
| URLSession.shared.dataTask(with: url) { (data, response, error) in | |
| if error != nil { | |
| print("Request failed with error: \(error?.localizedDescription)") | |
| return | |
| } | |
This file contains hidden or 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
| lass UIViewBasicsController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| self.view.backgroundColor = UIColor(named: "myColor") | |
| // Get the color value of system Colors through TraitCollection | |
| let yellow = UIColor.systemYellow | |
| let light = UITraitCollection(userInterfaceStyle: .light) |
This file contains hidden or 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 transformations() { | |
| let v1 = UIView(frame: CGRect(x: 113, y: 111, width: 132, height: 194)) | |
| v1.backgroundColor = .red | |
| let v2 = UIView(frame: v1.bounds.insetBy(dx: 10, dy: 10)) | |
| v2.backgroundColor = .yellow | |
| view.addSubview(v1) | |
| v1.addSubview(v2) | |
| v1.transform = CGAffineTransform(scaleX: 4, y: 2) | |
| v2.transform = CGAffineTransform(scaleX: 4, y: 5) |