Search code examples
swiftframeworksuicolor

Reading named colors from pods assets


i have created my framework which include named colors that will be used in application but when i run the application it crashes with null error even color is included in assets file of pod.

example code?

   static var blue:UIColor = UIColor(named: "AppBlueColor")!

it crashed with null exception. please help. Thankyou.


Solution

  • Include a resource bundle that contains your image files in your podspec like this:

    s.resources = "Sources/Images.xcassets"
    

    Also run pod install after the setup.