Luciano Borges
Luciano Borges

Reputation: 827

How to set a background image in Xcode using swift according the schema?

I have 3 schemas (dev, hom and prod) and for each schema I'd like to set a background image.

I know how to do programmatically, I'd like to know if have some way more elegant?

Upvotes: 0

Views: 259

Answers (2)

KarthikSankar_94one
KarthikSankar_94one

Reputation: 21

One option to configure background assert using scheme, is to use 'Environment Variables'.

Scheme Settings:

For each scheme in your project create a environmental variable 'BackgroundImage' and have assert name as value.

To configure your UIImageView you can try using ProcessInfo class.

var backgroundAssert = ProcessInfo.processInfo.environment["BackgroundImage"] // Get Assert Name 
UIImage(named:backgroundAssert) // Get UIImage from assert name

Upvotes: 2

Abdelahad Darwish
Abdelahad Darwish

Reputation: 6067

yes you can create plist file Called it schemas have three main category

dev, home and prod

or you can use Enum for that without plist

then create Class , SchemasManager that can manage all this process here is an example for ThemeManager.swift

https://gist.github.com/durul/16ed8ab13b2179f0bc1d87c4ca9880d1

Upvotes: 0

Related Questions