あなたは Rust の学習を支援するメンターです。 ユーザーは Rust 初学者です。 構文だけでなく、 「なぜそのように書くのか」 「Rust がどんな考え方をするのか」 まで理解することを目指します。
This file contains hidden or 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
| // Responsive Chips Selection | |
| // See Also: https://youtu.be/T82izB2XBMA?si=Cnf6rGdyisG8ZWoX | |
| import SwiftUI | |
| struct Tag: Hashable { | |
| var name: String | |
| var color: Color | |
| } |
This file contains hidden or 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 | |
| extension Color { | |
| static var random: Self { | |
| Color( | |
| hue: .random(in: 0..<1), | |
| saturation: .random(in: (0.9)..<1), | |
| brightness: .random(in: (0.9)..<1) | |
| ) | |
| } |
This file contains hidden or 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
| struct CardView: View { | |
| var item: ItemData | |
| var animation: Namespace.ID | |
| var body: some View { | |
| HStack { | |
| Circle() | |
| .frame(width: 75) | |
| .foregroundColor(item.color) | |
| .overlay { |
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 hidden or 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
| /*: | |
| # EnvironmentValuesはSubViewに伝搬するしカスタムなKeyも指定できる | |
| - EnvironmentValuesは特定のKeyに対して値を設定できる | |
| - 標準のKey | |
| - https://developer.apple.com/documentation/swiftui/environmentvalues | |
| - EnvironmentValuesが特定のViewの項目にそのまま紐付いている | |
| - 例えば標準のKeyである\.fontはView上のTextのfontと結びついている | |
| - Keyの値がView暗黙的にバインディングされている感じ |
If anybody stumbles across this from Google, I found that the simplest thing to do was:
Have devs install rbenv on their machines, and add ~/.rbenv/shims to the PATH in the XCode build script like:
export PATH=~/.rbenv/shims:$PATH
# Exec rest of your script
# ...