Skip to content

Instantly share code, notes, and snippets.

View simrandotdev's full-sized avatar

Simran simrandotdev

View GitHub Profile
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"
import UIKit
func loadData() {
do {
guard let url = URL(string: "https://reqres.in/api/users") else { return }
let body = [
"name": "Henry",
"job": "Engineer"
]
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
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>
Learning HTML
</title>
<style>
body {
//
// Order.swift
// Project05_Cupcakes
//
// Created by jc on 2020-08-13.
// Copyright © 2020 jc. All rights reserved.
//
import Foundation
@simrandotdev
simrandotdev / transformToDataExtensionOldMethodCode.Swift
Last active August 15, 2020 00:45
Old Method Code for video transformTo from a data object to Codable Models
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
}
@simrandotdev
simrandotdev / transformToDataExtensionStarterCode.Swift
Created August 15, 2020 00:30
Starter Code for video transformTo from a data object to Codable Models
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
}
@simrandotdev
simrandotdev / transformToDataExtensionFinalCode.swift
Last active August 15, 2020 00:45
Final Code for video transformTo from a data object to Codable Models
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
}
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)
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)