0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Xcode Playground(.swiftpm)で画像を表示する方法

0
Last updated at Posted at 2026-02-13

はじめに

XcodeでApp Playgroundを触ってみたら、Resourcesフォルダに格納した画像イメージが表示できなかった。

スクリーンショット 2026-02-13 15.49.43.png

↑Resources/cat.jpg の画像イメージが表示できない ↑

ChatGPT等のAIや、昔の記事では、「Resources」フォルダを作成し、その中に画像イメージを格納する旨の記述が多い。

しかし、現在のApp Playgroundでは「Resources」フォルダを認識する機能がないため別の方法を実施する。

ネット検索しても記事が見つからなかったため、記しておく。

環境

macOS Tahoe 26.0
Xcode 16.0

手順

左側のウィンドウを右クリックし、New Folderを押下

スクリーンショット 2026-02-13 15.38.40.png

画像の通り、「Assets.xcassets」と命名する。

スクリーンショット 2026-02-13 15.39.53.png

アイコンが変化することを確認する

スクリーンショット 2026-02-13 15.41.59.png

アイコンを左クリックする

スクリーンショット 2026-02-13 15.42.36.png

任意の画像をドラックアンドドロップする

スクリーンショット 2026-02-13 15.40.57.png

無事表示されることを確認

スクリーンショット 2026-02-13 15.44.10.png

まとめ

Package.swiftを変更したり、Resourceフォルダに入れたりして意外に詰まったので共有🙇‍♂️

0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?