SlideShare a Scribd company logo
1 of 22
Download to read offline
. ) . . ( .
)
-
.
let n = 42
42 func function(_ i: Int) -> Int {
return i + 42
}
let f = function
type(of: n)
// Int
type(of: f)
// (Int) -> Int
let n: Int = 42 let f: (Int) -> Int = function
let f: (Int) -> Int = { i in
return i + 42
}
Value Function
f(21)21 + n
Function
func output(_ i: Int) {
print(i)
}
output(n)
func output(_ i: Int,
_ m: (Int) -> Int)
{
print(m(i))
}
output(21, f)
func getN() -> Int {
let n = 42
return n
}
func getF() -> (Int) -> Int {
let f = { $0 + 42 }
return f
}
Value
Higher-Order Functions
func fs1(_ f: (((Int) -> Int) -> Int) -> Int) {
}
func fs2() -> (Int) -> (Int) -> (Int) -> Int {
}
Sync Action
@discardableResult
func createView<V : UIView>(_ view: V,
_ parent: UIView?,
_ setter: (V) -> Void) -> V {
parent?.addSubview(view)
setter(view)
return view
}
createView(UIImageView(), view) { iv in
iv.contentMode = .scaleAspectFill
iv.clipsToBounds = true
iv.layer.cornerRadius = 16
iv.frame = CGRect(x: 0, y: 0, width: 100, height: 100)
}
func downloadImage(from url: URL,
completion: @escaping (UIImage?) -> Void)
{
DispatchQueue.main.async {
if let image = try? UIImage(data: Data(contentsOf: url)) {
completion(image)
} else {
completion(nil)
}
}
}
downloadImage(from: URL(string: "image download url")!,
completion: { img in
self.imageView.image = img
})
Async Action
{
let fadeOutAlpha: CGFloat = 0
UIView.animate(withDuration: 0.3,
animations: {
self.button.alpha = fadeOutAlpha
},
completion: { completed in
self.button.isHidden = true
})
}
Closure
extension UIView {
@available(iOS 4.0, *)
open class func animate(withDuration duration: TimeInterval,
animations: @escaping () -> Void,
completion: ((Bool) -> Void)? = nil)
}
func downloadImage(completion: @escaping (UIImage?) -> Void)
{
DispatchQueue.main.async {
let url = URL(string: "image download url")!
let image = try! UIImage(data: Data(contentsOf: url))
completion(image)
}
}
Generalize
func gafunction(_ task: ((T) -> Void) -> Void) {
DispatchQueue.main.async {
task(job)
}
}
gaFunction(task: { f in
let url = URL(string: "image download url")!
let image = try! UIImage(data: Data(contentsOf: url))
f(image)
}, execute: { img in
self.imageView.image = img
})
func gaFunction<T>(task: @escaping ((@escaping (T) -> Void) -> Void),
execute: @escaping (T) -> Void)
{
DispatchQueue.main.async {
task(execute)
}
}
General Async Function
General Async Function Class
class GAFunction<T> {
private let task: ((@escaping (T) -> Void) -> Void)
init(task: @escaping (@escaping (T) -> Void) -> Void) {
self.task = task
}
func execute(_ f: @escaping (T) -> Void) {
DispatchQueue.main.async {
self.task(f)
}
}
}
class GAFunction<T> {
private let task: ((@escaping (T) -> Void) -> Void)
init(task job: @escaping (@escaping (T) -> Void) -> Void) {
task = job
}
func execute(_ f: @escaping (T) -> Void) {
DispatchQueue.main.async {
self.task(f)
}
}
}
GAFunction class
let gaf = GAFunction<UIImage?>(task: { f in
let url = URL(string: "image download url")!
let image = try! UIImage(data: Data(contentsOf: url))
f(image)
})
gaf.execute({ img in
self.imageView.image = img
})
Async Value
//42
//41
//40
extension GAFunction {
convenience init(just t: T) {
self.init(task: { f in f(t) })
}
convenience init(from ts: [T]) {
self.init(task: { f in ts.forEach(f) })
}
}
GAFunction(just: 42)
.execute({ i in
print(i)
})
GAFunction(from: [42, 41, 40])
.execute({ i in
print(i)
})
//42
Filter
//42
//40
//38
extension GAFunction {
func filter(_ filter: @escaping (T) -> Bool) -> GAFunction<T> {
return GAFunction<T>(task: { f in
self.execute({ t in
if filter(t) {
f(t)
}
})
})
}
}
GAFunction(from: [42, 41, 40, 39, 38])
.filter({ $0 % 2 == 0 })
.execute({ i in
print(i)
})
Map
//420
//410
//400
extension GAFunction {
func map<U>(_ mapper: @escaping (T) -> U) -> GAFunction<U> {
return GAFunction<U>(task: { f in
self.execute({ t in
f(mapper(t))
})
})
}
}
GAFunction(from: [42, 41, 40])
.map({ $0 * 10 })
.execute({ i in
print(i)
})
FlatMap
extension GAFunction {
public func flatMap<U>(_ mapper: @escaping (T) -> GAFunction<U>)
-> GAFunction<U>
{
return GAFunction<U>(task: { f in
self.execute({ t in
mapper(t).execute({ u in f(u) })
})
})
}
}
GAFunction(from: [42, 41, 40])
.flatMap({ i -> GAFunction<Float> in
GAFunction(just: Float(i) / 3)
})
.execute({ f in
print(f)
})
//14.0
//13.666667
//13.333333
All together
GAFunction(just: "image url")
.map({ URL(string: $0) })
.filter({ $0 != nil })
.map({ $0! })
.flatMap(downloadImage)
.execute({ img in
self.imageView.image = img
})
func downloadImage(_ url: URL) -> GAFunction<UIImage?> {
return GAFunction(task: { completion in
if let image = try? UIImage(data: Data(contentsOf: url)) {
completion(image)
} else {
completion(nil)
}
})
}
All together
GAFunction(just: "image url")
.map({ URL(string: $0) })
.filter({ $0 != nil })
.map({ $0! })
.flatMap(downloadImage)
.execute({ img in
self.imageView.image = img
})
func downloadImage(_ url: URL) -> GAFunction<UIImage?> {
return GAFunction(task: { completion in
if let image = try? UIImage(data: Data(contentsOf: url)) {
completion(image)
} else {
completion(nil)
}
})
}
Summary
1. ํ•จ์ˆ˜๋Š” value ์ฒ˜๋Ÿผโ€จ
- ๋ณ€์ˆ˜์— ๋‹ด์„ ์ˆ˜ ์žˆ๋‹คโ€จ
- ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋„˜๊ธธ ์ˆ˜ ์žˆ๋‹คโ€จ
- ๋ฆฌํ„ด๊ฐ’์œผ๋กœ ๋ฐ˜ํ™˜๋  ์ˆ˜ ์žˆ๋‹คโ€จ
2. ๊ณ ์ฐจํ•จ์ˆ˜(Higher-Order Function)โ€จ
- ํ•จ์ˆ˜๊ฐ€ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์“ฐ์ด๊ฑฐ๋‚˜ ๋ฐ˜ํ™˜๊ฐ’์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๊ฒฝ์šฐโ€จ
- ์ „๋‹ฌ๋œ ํ•จ์ˆ˜๊ฐ€ ๋ณธ์ฒด์˜ ์ˆ˜ํ–‰์ด ์ข…๋ฃŒ๋œ ํ›„์— ์‚ฌ์šฉ๋˜๋Š” ๊ฒฝ์šฐ @escaping์„ ํ•ด์ค˜์•ผ ํ•œ๋‹ค.โ€จ
- optional function ์€ @escaping์ด ๊ธฐ๋ณธ์ด๋‹ค.โ€จ
3. ํ•จ์ˆ˜๋Š” ํ–‰๋™์„ ์ €์žฅํ•œ๋‹คโ€จ
- ์ €์žฅํ•œ ํ–‰๋™์€ ์ „๋‹ฌ๋  ์ˆ˜ ์žˆ๋‹ค.โ€จ
- ์ €์žฅ๋œ ํ–‰๋™์€ ๋‚˜์ค‘์— ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋‹ค.โ€จ
4. ์ด๋Ÿฌํ•œ ํŠน์„ฑ๋“ค๋กœ ์—ฌ๋Ÿฌ ์žฌ๋ฐŒ๋Š” ๊ฒƒ๋“ค์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.โ€จ
- ์‚ฌ๋ก€. GAFunctionโ€จ
5. ์ด๋ฏธ ์ด๋Ÿฌํ•œ ์„ฑ์งˆ์„ ์ด์šฉํ•ด์„œ ๋ฒ”์šฉ์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์žˆ๋‹ค.โ€จ
- RxSwift ๋ฅผ ์“ฐ์ž
๊ด‘๊ณ 

More Related Content

What's hot

mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
Devnology
ย 
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
hwbloom25
ย 
Opp compile
Opp compileOpp compile
Opp compile
Muhammad Faiz
ย 

What's hot (20)

Cycle.js: Functional and Reactive
Cycle.js: Functional and ReactiveCycle.js: Functional and Reactive
Cycle.js: Functional and Reactive
ย 
UIKonf App & Data Driven Design @swift.berlin
UIKonf App & Data Driven Design @swift.berlinUIKonf App & Data Driven Design @swift.berlin
UIKonf App & Data Driven Design @swift.berlin
ย 
ZIO Queue
ZIO QueueZIO Queue
ZIO Queue
ย 
Blocks+gcdๅ…ฅ้–€
Blocks+gcdๅ…ฅ้–€Blocks+gcdๅ…ฅ้–€
Blocks+gcdๅ…ฅ้–€
ย 
GoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in GoGoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in Go
ย 
Designing Immutability Data Flows in Ember
Designing Immutability Data Flows in EmberDesigning Immutability Data Flows in Ember
Designing Immutability Data Flows in Ember
ย 
Drinking the free kool-aid
Drinking the free kool-aidDrinking the free kool-aid
Drinking the free kool-aid
ย 
Berlin meetup
Berlin meetupBerlin meetup
Berlin meetup
ย 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
ย 
CBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical fileCBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical file
ย 
Principled Error Handling with FP
Principled Error Handling with FPPrincipled Error Handling with FP
Principled Error Handling with FP
ย 
Pure Future
Pure FuturePure Future
Pure Future
ย 
C++ TUTORIAL 8
C++ TUTORIAL 8C++ TUTORIAL 8
C++ TUTORIAL 8
ย 
Print input-presentation
Print input-presentationPrint input-presentation
Print input-presentation
ย 
Fiber supervision in ZIO
Fiber supervision in ZIOFiber supervision in ZIO
Fiber supervision in ZIO
ย 
C++ TUTORIAL 6
C++ TUTORIAL 6C++ TUTORIAL 6
C++ TUTORIAL 6
ย 
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
ย 
Opp compile
Opp compileOpp compile
Opp compile
ย 
C++ TUTORIAL 7
C++ TUTORIAL 7C++ TUTORIAL 7
C++ TUTORIAL 7
ย 
Effector: we need to go deeper
Effector: we need to go deeperEffector: we need to go deeper
Effector: we need to go deeper
ย 

Similar to 20181020 advanced higher-order function

Swift the implicit parts
Swift the implicit partsSwift the implicit parts
Swift the implicit parts
Maxim Zaks
ย 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
Mario Fusco
ย 

Similar to 20181020 advanced higher-order function (20)

20191116 custom operators in swift
20191116 custom operators in swift20191116 custom operators in swift
20191116 custom operators in swift
ย 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
ย 
Kotlin for android developers whats new
Kotlin for android developers whats newKotlin for android developers whats new
Kotlin for android developers whats new
ย 
Swift the implicit parts
Swift the implicit partsSwift the implicit parts
Swift the implicit parts
ย 
Monadologie
MonadologieMonadologie
Monadologie
ย 
Functional JS for everyone - 4Developers
Functional JS for everyone - 4DevelopersFunctional JS for everyone - 4Developers
Functional JS for everyone - 4Developers
ย 
Implementing the IO Monad in Scala
Implementing the IO Monad in ScalaImplementing the IO Monad in Scala
Implementing the IO Monad in Scala
ย 
Taming Asynchronous Transforms with Interstellar
Taming Asynchronous Transforms with InterstellarTaming Asynchronous Transforms with Interstellar
Taming Asynchronous Transforms with Interstellar
ย 
(Fun)ctional go
(Fun)ctional go(Fun)ctional go
(Fun)ctional go
ย 
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
Stanfy MadCode Meetup #9: Functional Programming 101 with SwiftStanfy MadCode Meetup #9: Functional Programming 101 with Swift
Stanfy MadCode Meetup #9: Functional Programming 101 with Swift
ย 
Swift แ„’แ…กแ†ทแ„‰แ…ฎ แ„แ…ฅแ„…แ…ตแ†ผ แ„‰แ…กแ„‹แ…ญแ†ผแ„’แ…กแ„€แ…ต
Swift แ„’แ…กแ†ทแ„‰แ…ฎ แ„แ…ฅแ„…แ…ตแ†ผ แ„‰แ…กแ„‹แ…ญแ†ผแ„’แ…กแ„€แ…ตSwift แ„’แ…กแ†ทแ„‰แ…ฎ แ„แ…ฅแ„…แ…ตแ†ผ แ„‰แ…กแ„‹แ…ญแ†ผแ„’แ…กแ„€แ…ต
Swift แ„’แ…กแ†ทแ„‰แ…ฎ แ„แ…ฅแ„…แ…ตแ†ผ แ„‰แ…กแ„‹แ…ญแ†ผแ„’แ…กแ„€แ…ต
ย 
Rใฎใ‚นใ‚ณใƒผใƒ—ใจใƒ•ใƒฌใƒผใƒ ใจ็’ฐๅขƒใจ
Rใฎใ‚นใ‚ณใƒผใƒ—ใจใƒ•ใƒฌใƒผใƒ ใจ็’ฐๅขƒใจRใฎใ‚นใ‚ณใƒผใƒ—ใจใƒ•ใƒฌใƒผใƒ ใจ็’ฐๅขƒใจ
Rใฎใ‚นใ‚ณใƒผใƒ—ใจใƒ•ใƒฌใƒผใƒ ใจ็’ฐๅขƒใจ
ย 
Monads in Swift
Monads in SwiftMonads in Swift
Monads in Swift
ย 
Functional JavaScript for everyone
Functional JavaScript for everyoneFunctional JavaScript for everyone
Functional JavaScript for everyone
ย 
Scala - where objects and functions meet
Scala - where objects and functions meetScala - where objects and functions meet
Scala - where objects and functions meet
ย 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
ย 
lets play with "c"..!!! :):)
lets play with "c"..!!! :):)lets play with "c"..!!! :):)
lets play with "c"..!!! :):)
ย 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
ย 
The Strange World of Javascript and all its little Asynchronous Beasts
The Strange World of Javascript and all its little Asynchronous BeastsThe Strange World of Javascript and all its little Asynchronous Beasts
The Strange World of Javascript and all its little Asynchronous Beasts
ย 
FS2 for Fun and Profit
FS2 for Fun and ProfitFS2 for Fun and Profit
FS2 for Fun and Profit
ย 

More from Chiwon Song

20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต
20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต
20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต
Chiwon Song
ย 
์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)
์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)
์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)
Chiwon Song
ย 
20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP
20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP
20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP
Chiwon Song
ย 

More from Chiwon Song (20)

20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต
20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต
20240330_แ„€แ…ฉแ„€แ…ณแ†ธแ„Œแ…ตแ†ซ แ„แ…ฉแ„ƒแ…ณแ„…แ…ณแ†ฏ แ„‹แ…ฑแ„’แ…กแ†ซ exception แ„ƒแ…กแ„…แ…ฎแ„€แ…ต
ย 
์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)
์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)
์š”์ฆ˜ ์œ ํ–‰ํ•˜๋Š” AI ๋‚˜๋„ ํ•ด๋ณด์ž (feat. CoreML)
ย 
20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP
20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP
20220716_แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„†แ…งแ†ซแ„‰แ…ฅ แ„‚แ…ณ๊ปด๋ณด๋Š” POP
ย 
20210812 ์ปดํ“จํ„ฐ๋Š” ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”๊ฐ€?
20210812 ์ปดํ“จํ„ฐ๋Š” ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”๊ฐ€?20210812 ์ปดํ“จํ„ฐ๋Š” ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”๊ฐ€?
20210812 ์ปดํ“จํ„ฐ๋Š” ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”๊ฐ€?
ย 
20201121 ์ฝ”๋“œ ์‚ผ๋ถ„์ง€๊ณ„
20201121 ์ฝ”๋“œ ์‚ผ๋ถ„์ง€๊ณ„20201121 ์ฝ”๋“œ ์‚ผ๋ถ„์ง€๊ณ„
20201121 ์ฝ”๋“œ ์‚ผ๋ถ„์ง€๊ณ„
ย 
20200815 inversions
20200815 inversions20200815 inversions
20200815 inversions
ย 
[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰_๊ต์•ˆ
[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰_๊ต์•ˆ[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰_๊ต์•ˆ
[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰_๊ต์•ˆ
ย 
[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰
[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰
[20190601] ์ง์—…ํ›ˆ๋ จ๊ต์‚ฌ_์ˆ˜์—…์˜์‹คํ–‰
ย 
20190330 immutable data
20190330 immutable data20190330 immutable data
20190330 immutable data
ย 
20190306 ๋งŒ๋“ค๋ฉด์„œ ๋ฐฐ์šฐ๋Š” IoT / IoT์˜ ์ดํ•ด
20190306 ๋งŒ๋“ค๋ฉด์„œ ๋ฐฐ์šฐ๋Š” IoT / IoT์˜ ์ดํ•ด20190306 ๋งŒ๋“ค๋ฉด์„œ ๋ฐฐ์šฐ๋Š” IoT / IoT์˜ ์ดํ•ด
20190306 ๋งŒ๋“ค๋ฉด์„œ ๋ฐฐ์šฐ๋Š” IoT / IoT์˜ ์ดํ•ด
ย 
20171104 FRP แ„‘แ…ขแ„…แ…ฅแ„ƒแ…กแ„‹แ…ตแ†ท
20171104 FRP แ„‘แ…ขแ„…แ…ฅแ„ƒแ…กแ„‹แ…ตแ†ท20171104 FRP แ„‘แ…ขแ„…แ…ฅแ„ƒแ…กแ„‹แ…ตแ†ท
20171104 FRP แ„‘แ…ขแ„…แ…ฅแ„ƒแ…กแ„‹แ…ตแ†ท
ย 
แ„‰แ…ณแ„แ…ณแ„…แ…ขแ„Žแ…ตแ„…แ…ฉ แ„‰แ…ตแ„Œแ…กแ†จแ„’แ…กแ„‚แ…ณแ†ซ แ„แ…ฉแ„ƒแ…ตแ†ผ
แ„‰แ…ณแ„แ…ณแ„…แ…ขแ„Žแ…ตแ„…แ…ฉ แ„‰แ…ตแ„Œแ…กแ†จแ„’แ…กแ„‚แ…ณแ†ซ แ„แ…ฉแ„ƒแ…ตแ†ผแ„‰แ…ณแ„แ…ณแ„…แ…ขแ„Žแ…ตแ„…แ…ฉ แ„‰แ…ตแ„Œแ…กแ†จแ„’แ…กแ„‚แ…ณแ†ซ แ„แ…ฉแ„ƒแ…ตแ†ผ
แ„‰แ…ณแ„แ…ณแ„…แ…ขแ„Žแ…ตแ„…แ…ฉ แ„‰แ…ตแ„Œแ…กแ†จแ„’แ…กแ„‚แ…ณแ†ซ แ„แ…ฉแ„ƒแ…ตแ†ผ
ย 
แ„†แ…ฆแ„‹แ…ตแ„แ…ฅแ„‹แ…ฎแ†ซแ„ƒแ…ฉแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
แ„†แ…ฆแ„‹แ…ตแ„แ…ฅแ„‹แ…ฎแ†ซแ„ƒแ…ฉแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„†แ…ฆแ„‹แ…ตแ„แ…ฅแ„‹แ…ฎแ†ซแ„ƒแ…ฉแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
แ„†แ…ฆแ„‹แ…ตแ„แ…ฅแ„‹แ…ฎแ†ซแ„ƒแ…ฉแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
ย 
แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ RCแ„แ…ก แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„€แ…ต
แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ RCแ„แ…ก แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„€แ…ตแ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ RCแ„แ…ก แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„€แ…ต
แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ RCแ„แ…ก แ„†แ…กแ†ซแ„ƒแ…ณแ†ฏแ„€แ…ต
ย 
[5] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„…แ…ฉ แ„†แ…กแ†ซแ„ƒแ…ณแ„‚แ…ณแ†ซ IoT
[5] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„…แ…ฉ แ„†แ…กแ†ซแ„ƒแ…ณแ„‚แ…ณแ†ซ IoT[5] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„…แ…ฉ แ„†แ…กแ†ซแ„ƒแ…ณแ„‚แ…ณแ†ซ IoT
[5] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„…แ…ฉ แ„†แ…กแ†ซแ„ƒแ…ณแ„‚แ…ณแ†ซ IoT
ย 
[4] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„‹แ…ช แ„‹แ…ตแ†ซแ„แ…ฅแ„‚แ…ฆแ†บ
[4] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„‹แ…ช แ„‹แ…ตแ†ซแ„แ…ฅแ„‚แ…ฆแ†บ[4] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„‹แ…ช แ„‹แ…ตแ†ซแ„แ…ฅแ„‚แ…ฆแ†บ
[4] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉแ„‹แ…ช แ„‹แ…ตแ†ซแ„แ…ฅแ„‚แ…ฆแ†บ
ย 
[2] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ แ„’แ…ชแ†ฏแ„‹แ…ญแ†ผ แ„‰แ…ตแ†ฏแ„‰แ…ณแ†ธ
[2] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ แ„’แ…ชแ†ฏแ„‹แ…ญแ†ผ แ„‰แ…ตแ†ฏแ„‰แ…ณแ†ธ[2] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ แ„’แ…ชแ†ฏแ„‹แ…ญแ†ผ แ„‰แ…ตแ†ฏแ„‰แ…ณแ†ธ
[2] แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ แ„’แ…ชแ†ฏแ„‹แ…ญแ†ผ แ„‰แ…ตแ†ฏแ„‰แ…ณแ†ธ
ย 
[3] แ„‘แ…ณแ„…แ…ฉแ„‰แ…ฆแ„‰แ…ตแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
[3] แ„‘แ…ณแ„…แ…ฉแ„‰แ…ฆแ„‰แ…ตแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ[3] แ„‘แ…ณแ„…แ…ฉแ„‰แ…ฆแ„‰แ…ตแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
[3] แ„‘แ…ณแ„…แ…ฉแ„‰แ…ฆแ„‰แ…ตแ†ผแ„€แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
ย 
[1] IoTแ„‹แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
[1] IoTแ„‹แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ[1] IoTแ„‹แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
[1] IoTแ„‹แ…ช แ„‹แ…กแ„ƒแ…ฎแ„‹แ…ตแ„‚แ…ฉ
ย 
3D ํ”„๋ฆฐํ„ฐ์™€ ์•„๋‘์ด๋…ธ
3D ํ”„๋ฆฐํ„ฐ์™€ ์•„๋‘์ด๋…ธ3D ํ”„๋ฆฐํ„ฐ์™€ ์•„๋‘์ด๋…ธ
3D ํ”„๋ฆฐํ„ฐ์™€ ์•„๋‘์ด๋…ธ
ย 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
ย 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
ย 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
ย 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
ย 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
ย 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
ย 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
ย 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
ย 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
ย 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
ย 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
ย 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
ย 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
ย 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
ย 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
ย 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
ย 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
ย 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
ย 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
ย 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ย 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
ย 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
ย 

20181020 advanced higher-order function

  • 1. . ) . . ( . ) - .
  • 2.
  • 3. let n = 42 42 func function(_ i: Int) -> Int { return i + 42 } let f = function type(of: n) // Int type(of: f) // (Int) -> Int let n: Int = 42 let f: (Int) -> Int = function let f: (Int) -> Int = { i in return i + 42 } Value Function f(21)21 + n
  • 4. Function func output(_ i: Int) { print(i) } output(n) func output(_ i: Int, _ m: (Int) -> Int) { print(m(i)) } output(21, f) func getN() -> Int { let n = 42 return n } func getF() -> (Int) -> Int { let f = { $0 + 42 } return f } Value
  • 5. Higher-Order Functions func fs1(_ f: (((Int) -> Int) -> Int) -> Int) { } func fs2() -> (Int) -> (Int) -> (Int) -> Int { }
  • 6.
  • 7. Sync Action @discardableResult func createView<V : UIView>(_ view: V, _ parent: UIView?, _ setter: (V) -> Void) -> V { parent?.addSubview(view) setter(view) return view } createView(UIImageView(), view) { iv in iv.contentMode = .scaleAspectFill iv.clipsToBounds = true iv.layer.cornerRadius = 16 iv.frame = CGRect(x: 0, y: 0, width: 100, height: 100) }
  • 8. func downloadImage(from url: URL, completion: @escaping (UIImage?) -> Void) { DispatchQueue.main.async { if let image = try? UIImage(data: Data(contentsOf: url)) { completion(image) } else { completion(nil) } } } downloadImage(from: URL(string: "image download url")!, completion: { img in self.imageView.image = img }) Async Action
  • 9. { let fadeOutAlpha: CGFloat = 0 UIView.animate(withDuration: 0.3, animations: { self.button.alpha = fadeOutAlpha }, completion: { completed in self.button.isHidden = true }) } Closure extension UIView { @available(iOS 4.0, *) open class func animate(withDuration duration: TimeInterval, animations: @escaping () -> Void, completion: ((Bool) -> Void)? = nil) }
  • 10.
  • 11. func downloadImage(completion: @escaping (UIImage?) -> Void) { DispatchQueue.main.async { let url = URL(string: "image download url")! let image = try! UIImage(data: Data(contentsOf: url)) completion(image) } } Generalize func gafunction(_ task: ((T) -> Void) -> Void) { DispatchQueue.main.async { task(job) } }
  • 12. gaFunction(task: { f in let url = URL(string: "image download url")! let image = try! UIImage(data: Data(contentsOf: url)) f(image) }, execute: { img in self.imageView.image = img }) func gaFunction<T>(task: @escaping ((@escaping (T) -> Void) -> Void), execute: @escaping (T) -> Void) { DispatchQueue.main.async { task(execute) } } General Async Function
  • 13. General Async Function Class class GAFunction<T> { private let task: ((@escaping (T) -> Void) -> Void) init(task: @escaping (@escaping (T) -> Void) -> Void) { self.task = task } func execute(_ f: @escaping (T) -> Void) { DispatchQueue.main.async { self.task(f) } } }
  • 14. class GAFunction<T> { private let task: ((@escaping (T) -> Void) -> Void) init(task job: @escaping (@escaping (T) -> Void) -> Void) { task = job } func execute(_ f: @escaping (T) -> Void) { DispatchQueue.main.async { self.task(f) } } } GAFunction class let gaf = GAFunction<UIImage?>(task: { f in let url = URL(string: "image download url")! let image = try! UIImage(data: Data(contentsOf: url)) f(image) }) gaf.execute({ img in self.imageView.image = img })
  • 15. Async Value //42 //41 //40 extension GAFunction { convenience init(just t: T) { self.init(task: { f in f(t) }) } convenience init(from ts: [T]) { self.init(task: { f in ts.forEach(f) }) } } GAFunction(just: 42) .execute({ i in print(i) }) GAFunction(from: [42, 41, 40]) .execute({ i in print(i) }) //42
  • 16. Filter //42 //40 //38 extension GAFunction { func filter(_ filter: @escaping (T) -> Bool) -> GAFunction<T> { return GAFunction<T>(task: { f in self.execute({ t in if filter(t) { f(t) } }) }) } } GAFunction(from: [42, 41, 40, 39, 38]) .filter({ $0 % 2 == 0 }) .execute({ i in print(i) })
  • 17. Map //420 //410 //400 extension GAFunction { func map<U>(_ mapper: @escaping (T) -> U) -> GAFunction<U> { return GAFunction<U>(task: { f in self.execute({ t in f(mapper(t)) }) }) } } GAFunction(from: [42, 41, 40]) .map({ $0 * 10 }) .execute({ i in print(i) })
  • 18. FlatMap extension GAFunction { public func flatMap<U>(_ mapper: @escaping (T) -> GAFunction<U>) -> GAFunction<U> { return GAFunction<U>(task: { f in self.execute({ t in mapper(t).execute({ u in f(u) }) }) }) } } GAFunction(from: [42, 41, 40]) .flatMap({ i -> GAFunction<Float> in GAFunction(just: Float(i) / 3) }) .execute({ f in print(f) }) //14.0 //13.666667 //13.333333
  • 19. All together GAFunction(just: "image url") .map({ URL(string: $0) }) .filter({ $0 != nil }) .map({ $0! }) .flatMap(downloadImage) .execute({ img in self.imageView.image = img }) func downloadImage(_ url: URL) -> GAFunction<UIImage?> { return GAFunction(task: { completion in if let image = try? UIImage(data: Data(contentsOf: url)) { completion(image) } else { completion(nil) } }) }
  • 20. All together GAFunction(just: "image url") .map({ URL(string: $0) }) .filter({ $0 != nil }) .map({ $0! }) .flatMap(downloadImage) .execute({ img in self.imageView.image = img }) func downloadImage(_ url: URL) -> GAFunction<UIImage?> { return GAFunction(task: { completion in if let image = try? UIImage(data: Data(contentsOf: url)) { completion(image) } else { completion(nil) } }) }
  • 21. Summary 1. ํ•จ์ˆ˜๋Š” value ์ฒ˜๋Ÿผโ€จ - ๋ณ€์ˆ˜์— ๋‹ด์„ ์ˆ˜ ์žˆ๋‹คโ€จ - ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋„˜๊ธธ ์ˆ˜ ์žˆ๋‹คโ€จ - ๋ฆฌํ„ด๊ฐ’์œผ๋กœ ๋ฐ˜ํ™˜๋  ์ˆ˜ ์žˆ๋‹คโ€จ 2. ๊ณ ์ฐจํ•จ์ˆ˜(Higher-Order Function)โ€จ - ํ•จ์ˆ˜๊ฐ€ ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ์“ฐ์ด๊ฑฐ๋‚˜ ๋ฐ˜ํ™˜๊ฐ’์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๊ฒฝ์šฐโ€จ - ์ „๋‹ฌ๋œ ํ•จ์ˆ˜๊ฐ€ ๋ณธ์ฒด์˜ ์ˆ˜ํ–‰์ด ์ข…๋ฃŒ๋œ ํ›„์— ์‚ฌ์šฉ๋˜๋Š” ๊ฒฝ์šฐ @escaping์„ ํ•ด์ค˜์•ผ ํ•œ๋‹ค.โ€จ - optional function ์€ @escaping์ด ๊ธฐ๋ณธ์ด๋‹ค.โ€จ 3. ํ•จ์ˆ˜๋Š” ํ–‰๋™์„ ์ €์žฅํ•œ๋‹คโ€จ - ์ €์žฅํ•œ ํ–‰๋™์€ ์ „๋‹ฌ๋  ์ˆ˜ ์žˆ๋‹ค.โ€จ - ์ €์žฅ๋œ ํ–‰๋™์€ ๋‚˜์ค‘์— ์‚ฌ์šฉ๋  ์ˆ˜ ์žˆ๋‹ค.โ€จ 4. ์ด๋Ÿฌํ•œ ํŠน์„ฑ๋“ค๋กœ ์—ฌ๋Ÿฌ ์žฌ๋ฐŒ๋Š” ๊ฒƒ๋“ค์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋‹ค.โ€จ - ์‚ฌ๋ก€. GAFunctionโ€จ 5. ์ด๋ฏธ ์ด๋Ÿฌํ•œ ์„ฑ์งˆ์„ ์ด์šฉํ•ด์„œ ๋ฒ”์šฉ์œผ๋กœ ๋งŒ๋“ค์–ด์ง„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์žˆ๋‹ค.โ€จ - RxSwift ๋ฅผ ์“ฐ์ž