Warning: Your Xcode (14.0.1) is too outdated.

こんなのでました。


❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Your Xcode (14.0.1) is too outdated.
Please update to Xcode 14.1 (or delete it).
Xcode can be updated from the App Store.

❯ softwareupdate --list
Software Update Tool

Finding available software
No new software available.

❯ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.1.

Warning: Your Xcode (14.0.1) is outdated.
Please update to Xcode 14.1 (or delete it).
Xcode can be updated from the App Store.


❯ softwareupdate --all --install --force
Software Update Tool

Finding available software
No updates are available.

❯ sudo rm -rf /Library/Developer/CommandLineTools
Password:

❯ sudo xcode-select --install
xcode-select: note: install requested for command line developer tools

AppStore は、14.0.1 のまま。

ダメですね。

表示されたマニュアルダウンロード先を見てみたら、

RC2 なんだが。

👉 More - Downloads - Apple Developer hatena-bookmark

調べてみると、多少、話題にはなってる。

Please install the release candidate. Xcode 14.0.1 does not include the SDK for Ventura.

👉 Brew apparently requires a nonexistent xcode version? · Discussion #3822 · Homebrew hatena-bookmark

もう、手動GUI作業で入れちゃいました XcodeRC と、そのCLI。

dmg とでかい xip ファイルでした。

Xcode 14.1

確認。


❯ softwareupdate --list
Software Update Tool

Finding available software
No new software available.

❯ xcode-select -v
xcode-select version 2396.

❯ xcodebuild -version
Xcode 14.1
Build version 14B47b

❯ brew doctor
Your system is ready to brew.

これでいきますわ、とりあえず。

👉 Weird that they didn't release Xcode 14.1 yesterday, it's required for Mac OS 13 development. | MacRumors Forums hatena-bookmark


【Jetpack Compose】ViewModel を捨てて Repository を Composable に直結する

 

気になるのはライフサイクル。

 

きっかけ

フル Compose でよくあるTodoのようなメモのようなアプリを作ってみました。

一通りの機能は実装しました。




👉 Jetpack Compose without ViewModel #shorts - YouTube hatena-bookmark

いろいろ Compose を試しながら進んでいくと ViewModel がスカスカになりました。


@HiltViewModel
class TodoViewModel @Inject constructor(
  private val repository: TodoRepositoryInterface
) : ViewModel() {

  val items: Flow<List<Todo>> = repository.load()

  fun insert(text: String) = repository.insert(text)

  fun update(id: Long, text: String) = repository.update(id, text)

  fun delete(id: Long) = repository.delete(id)

}

ViewModel いらなくね?

ViewModel を省略して、Repository を直結します。

 

結果

以下、少しの書き換えで問題なく動きます。


@Composable
fun TodoScreen(
  //viewModel: TodoViewModel = hiltViewModel()
  repository: TodoRepository = TodoRepository(
    Database(
      AndroidSqliteDriver(
        schema = Database.Schema,
        context = LocalContext.current,
        name = "database.db"
      )
    )
  )
) {


//val items by viewModel.items.collectAsState(initial = emptyList())
val items by repository.load().collectAsState(initial = emptyList())


//viewModel.insert(target.text)
repository.insert(target.text)


//viewModel.update(target.id, target.text) 
repository.update(target.id, target.text)


//viewModel.delete(target.id)
repository.delete(target.id)


//viewModel.delete(target.id)
repository.delete(target.id)

画面回転問題なし、メモリーリークもありません。

すんなりです。

Square製 SQLDelight + Flow(coroutine extension) を使っていますが、

Room + LiveData でもいけると思います。

Composable で Flow(LiveData) を受け取った瞬間に、

collectAsState(ObserveAsState) で State に変換できるんなら、

それのほうが良くね?

ライフサイクルの差も気にしなくていいし。

しかし、緩衝国がなくなるのはなんだか不安です。

Hilt で @Singleton で、ぶち込んでやりたかったです。

あ、でもこれ、 re-compose のたびに、Repository インスタンスが...

(つづく...)

👉 「SwiftUIでMVVMを採用するのは止めよう」と思い至った理由 - Qiita hatena-bookmark
👉 ViewModel はいつ生まれていつ死ぬか 【→ Jetpack Compose】 hatena-bookmark
👉 Jetpack ComposeとViewModelについて考える - Blog - Mori Atsushi hatena-bookmark


【macOS】横長ワイドなディスプレイで使いたいウィンドウマネージャーを探す

Split View で Mac の App を 2 つ並べて表示する
👉 Split View で Mac の App を 2 つ並べて表示する - Apple サポート (日本) hatena-bookmark

macOS 純正「Split View」は、なんとなくツラかったので、

いくつか入れてみました、無料のウィンドウマネージャー。

やりたかったのは、

「すばやくウィンドウを左右半分の大きさにして配置する」

ということです。

 

ShiftIt

インストールするといいかんじです。

Monterey でも問題なく動きます。

ShiftIt Managing window size and position in OSX
👉 fikovnik/ShiftIt: Managing windows size and position in OSX hatena-bookmark

しかし、リポジトリを見ると数年更新されていません。

This project is looking for a new maintainer. Until that transition is completed, there will likely not be further development on this project.

This project is looking for a new maintainer. Until that transition is completed, there will likely not be further development on this project.

今後、更新はされないかもしれない雰囲気です。

 

Spectacle

Move and resize windows with ease
👉 Spectacle hatena-bookmark
👉 eczarny/spectacle: Spectacle allows you to organize your windows without using a mouse. hatena-bookmark

しかし、このアプリもメンテナンス終了っぽいです。

This project is not being actively maintained.

代替として「Rectangle」なるものを推奨しています。

Spectacle users have recommended Rectangle as an open source alternative.

 

Rectangle

Rectangle: Move and resize windows on macOS with keyboard shortcuts and snap areas

当分これを使ってみることにします。

リポジトリも元気ですし、フォークやスターの数も多いです。

Rectangle: Move and resize windows on macOS with keyboard shortcuts and snap areas

👉 rxhanson/Rectangle: Move and resize windows on macOS with keyboard shortcuts and snap areas hatena-bookmark

このアプリも他のウィンドウマネージャーアプリと同様、以下のように

アクセシビリティアプリケーションにMacへのアクセスを許可する

アクセスの許可が必要になります。

👉 アクセシビリティアプリケーションにMacへのアクセスを許可する - Apple サポート (日本) hatena-bookmark

👉 多窓ブラウザは vivaldi が最強 hatena-bookmark