The Composable Architecture (省略すると TCA) は、コンポジション、テスト、開発者にとっての使いやすさを考慮し、一貫性のある理解しやすい方法でアプリケーションを構築するためのライブラリです。SwiftUI、UIKit などで使用することができ、Apple のどのプラットフォーム (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
import SwiftUI | |
struct Item: Identifiable { | |
let id = UUID() | |
var text = "" | |
var color: Color = .clear | |
} | |
struct CarouselView: View { | |
var items: [Item] = [ |
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 SwiftUI | |
private struct AlertPresentationWindow: View { | |
@ObservedObject var service: ErrorStateService | |
var body: some View { | |
Color.clear | |
.alert( | |
service.alerts.first?.title ?? "Error", | |
isPresented: .init( |
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
// | |
// NetworkPlaygroundApp.swift | |
// NetworkPlayground | |
// | |
// Created by treastrain / Tanaka Ryoga on 2021/09/28. | |
// | |
import SwiftUI | |
import Network |
Xcode の Run Script Phase で rbenv が効いておらず困っていたが、解決できたのでメモ
- Run Script Phaseから
PATH
環境変数に~/.rbenv/shims/
を追加すれば良い。 - ただし、直接
~/.rbenv/shims/
を参照するとrbenvに依存してしまう。rbenvは透過的であってほしいのにrbenvに依存してしまってよくない。 - そこで dependency inversion を行う. Run Script Phase は
.xcode-env
というスクリプトを呼び出すようにして、.xcode-env
は各システム環境で用意する. rbenvを使うべき環境では.xcode-env
の中で~/.rbenv/shims/
を参照する - やりたかったこと: fastlaneを(rbenv経由で) 走らせたい
.zshenv
等でPATHを編集すれば効くかなと思ったらRun Script Phaseの中では効かなかった- 下記の記事を参考にした: https://gist.github.com/vyder/2386a03affba03dadb2bc7c3f0bf7b8a
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 SwiftUI | |
import Network | |
final class ViewModel: ObservableObject { | |
@Published var status: NWPath.Status = .satisfied | |
init() { | |
NWPathMonitor() | |
.publisher() | |
.map { $0.status } |
NewerOlder