【Xcode】ローカルと GitHub のソース管理連携設定

GitHub で久々に新規にリポジトリ作成してみたら、

もしかして、表示されなくなりました? こういうスクリプト。


Quick setup - if you've done this kind of thing before
https://github.com/your-account/sample.git


// ... or create a new repository on the command line

echo "# sample" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/your-account/sample.git
pit push -u origin main


// ... or push an existing repository from the command line

git remote add origin https://github.com/your-account/sample.git
git branch -M main
git push -u orign main

👉 Github Quick setup — if you’ve done this kind of thing before hatena-bookmark

困ったので以下のやり方でやったらいけた。

👉 XcodeとGitHubの連携方法 #macOS - Qiita hatena-bookmark

ローカルにプロジェクトのソースはある。として、

そこからの「連携」の手順を最小限で覚えておく。

Control + クリック、かまたは 右クリックから


「New "PROJECT-NAME" Remote...」 で新規作成

で、リモート側(GitHub側)のリポジトリを作成して連携できる。

リモート側(GitHub側)にすでに作成済みの場合は、


「Add Existing Remote...」で既存リモートに接続

と選択すれば、あとは流れで分かる。

GUIからのキーバインド的なやつ。知らんと見つけるのつらいので書いておこうとな。

👉 Configuring your Xcode project to use source control | Apple Developer Documentation hatena-bookmark

続いて.gitignore はこちら。



【SwiftUI】 スクレイピングで GitHub Contribution Graph をつくる

WEB-API もあるようですが。


❯ curl -s https://github.com/users/benigumocom/contributions

で、HTMLが取得できるというのでやってみる。

わーい。

guard ってなんとなく嫌いだなあ。

👉 GitHub Gist のコードをスクリプトから更新する方法 hatena-bookmark


【SwiftUI】Conway's Game of Life

2次元配列を扱っていると作りたくなります。

👉 Conway's Game of Life - Wikipedia hatena-bookmark

GitHub に上手できれいなコードが公開されているので流用してみます。

👉 lifegame/swift/lifegame.swift at master · tex2e/lifegame hatena-bookmark

SwiftUI周りのみ書いてみました。

タップでスタート、ストップ。

ダブルタップでリセットです。

少し思うのが、

GeometryReader

てのどうなのか。

なんとなく気持ち悪くないですかね。

👉 Is SwiftUI GeometryReader bad? : iOSProgramming hatena-bookmark