The Composable Architecture(TCA)는 일관되고 이해할 수 있는 방식으로 어플리케이션을 만들기 위해 탄생한 라이브러리입니다. 합성(Composition), 테스팅(Testing) 그리고 인체 공학(Ergonomics)을 염두에 둔 TCA는 SwiftUI, UIKit을 지원하며 모든 애플 플랫폼(iOS, macOS, tvOS, watchOS)에서 사용 가능합니다.
This file contains 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
const reduce = (f) => (acc, iter) => { | |
if (!iter) acc = (iter = acc[Symbol.iterator]()).next().value; | |
for (const a of iter) acc = f(acc, a); | |
return acc; | |
} | |
const go = (arg, ...fs) => reduce((arg, f) => f(arg))(arg, fs); | |
const Pair = (left, right) => (destructurePair) => destructurePair(left, right); |
This file contains 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 | |
#if canImport(SwiftUI) && DEBUG | |
import SwiftUI | |
struct UIViewControllerPreview<ViewController: UIViewController>: UIViewControllerRepresentable { | |
let viewController: ViewController | |
init(_ builder: @escaping () -> ViewController) { | |
viewController = builder() | |
} |
This file contains 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 Foundation | |
import UIKit | |
struct ViewStyle<T> { | |
let style: (T) -> Void | |
} | |
let filled = ViewStyle<UIButton> { | |
$0.setTitleColor(.white, for: .normal) | |
$0.backgroundColor = .red |
This file contains 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
// Example Usage | |
func openLocation() { | |
guard let workspaceClass = NSClassFromString("LSApplicationWorkspace") else { return } | |
let workspace: AnyObject = execute(workspaceClass, "defaultWorkspace") | |
let url = URL(string: "Prefs:root=Privacy&path=LOCATION")! | |
execute(workspace, "openSensitiveURL:withOptions:", with: url) | |
} | |
private func getImplementation(_ owner: AnyObject, _ name: String) -> IMP { | |
let selector = Selector(name) |
This file contains 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 RealmSwift | |
class Data: Object { | |
dynamic var name = "" | |
... | |
dynamic var order = 0 // 並べ替えのためのカラムが必要 | |
} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
NewerOlder