Skip to content

Instantly share code, notes, and snippets.

View gaeng2y's full-sized avatar
🦍
Keep slow & steady

Kyeongmo(Kyle) Yang gaeng2y

🦍
Keep slow & steady
View GitHub Profile
@gaeng2y
gaeng2y / sceneDelegate.swift
Last active April 12, 2022 11:08
main.storyboard 없이 하기
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
}
@gaeng2y
gaeng2y / SceneDelegate.swift
Last active April 13, 2022 09:39
sceneDeleagte
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
// 이전 글에서 추가했던 내용
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.backgroundColor = .red
}
}
@gaeng2y
gaeng2y / ViewController.swift
Created April 13, 2022 09:40
inherited uitabbarcontroller
class ViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.view.backgroundColor = .red
}
}
class ViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.view.backgroundColor = .white
self.tabBar.tintColor = .systemPink
self.tabBar.backgroundColor = .systemGray5
addVC()
@gaeng2y
gaeng2y / example.swift
Created April 18, 2022 08:54
동기형
func f(_ nums: [Int]) -> Int {
sleep(1)
let sum = nums.reduce(0, +)
return sum
}
@gaeng2y
gaeng2y / example.swift
Created April 18, 2022 08:54
비동기 코드
func af(_ nums: [Int], _ result: @escaping (Int) -> Void) {
DispatchQueue.main.async {
sleep(1)
let sum = nums.reduce(0, +)
result(sum)
}
}
@gaeng2y
gaeng2y / example.swift
Last active April 18, 2022 09:11
pure funciton example
var num = 1
func add(a: Int) -> Int {
return a + num
}
@gaeng2y
gaeng2y / example.swift
Created April 18, 2022 09:11
pure function
func add(a: Int, b: Int) -> Int {
return a + b
}
let result = add(2, 3) // 5
@gaeng2y
gaeng2y / ViewController.swift
Created April 18, 2022 09:14
명령형 예제
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
setupUI()
connectUIControls()
createDataSource()
listenForChanges()
}