0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【SwiftUI】マルチモジュールで画像を表示する

Last updated at Posted at 2023-12-14

始めに

マルチモジュール化してから同じモジュール内にあるxcassetsファイルで画像をセットしたのに表示できませんでした。

※以下のようにGuideViewでMedia.xcassetsでセットした画像を表示したい

スクリーンショット 2023-12-14 10.51.05.png

結論

以下は、Media.xcassetsでセットした画像です。今回は、"IMG"という画像を表示します。
スクリーンショット 2023-12-14 10.53.41.png

Image("IMG", bundle: Bundle.module)

これで表示できました。

まとめ

Image("IMG")

上記の書き方で表示できると勘違いしてました…

異なるモジュールにある画像を表示したいときは以下の記事が参考になりそうです!

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?