Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 9 not finding assets after using xcode 10

Tags:

xcode

ios

swift

I downloaded Xcode 10 to test some new features on a project, Now when I reopen the same project on Xcode 9. It seems that Xcode can't find any assets ( images)

This would work fine on Xcode 10 :

let image = UIImage(named: "AsunnyDay")
// this would find the correct image

However, on Xcode 9

let image = UIImage(named: "AsunnyDay")
//image would be nil

I guess it's something related to XCode 10 categorizing the assets as either for dark appearance or light. but I don't understand why would Xcode 9 not find them.

like image 844
Wassim Seifeddine Avatar asked Jun 07 '18 04:06

Wassim Seifeddine


1 Answers

Guys this is how I fixed it.

  1. Open project in Xcode 10 beta
  2. Go to the assets
  3. Select all the images you have
  4. In the inspector, you will have an option to choose the appearance type. Choose Any, Light,Dark Xcode 10 Appearance
  5. This will create extra placeholders for other images: Extra Assets
  6. Open Project in Xcode 9. the assets will look something like this Extra Assets
  7. Reorder the 1x , 2x , 3x into place. Reorder
  8. Delete the extra unassigned placeholders Final
  9. Done
like image 98
Wassim Seifeddine Avatar answered Sep 27 '22 23:09

Wassim Seifeddine