PWTheming
is a Swift package that provides a simple way to apply different design themes to your iOS application.
With PWTheming
, you can easily change the look and feel of your app by switching between different themes at runtime.
To use PWTheming
in your project, first import the module:
import PWTheming
To create a theme, simply create a new struct
conforming to the PWTheme
protocol:
public protocol PWTheme {
var background: BackgroundColors { get }
var label: LabelColors { get }
var fill: FillColors { get }
var signature: SignatureColors { get }
}
Per default there is a PWAppleTheme
available and set as the default theme as part of this package.
This theme uses the default system colors from Apple.
You can customize the colors of various UI elements by setting the corresponding properties instance.
In your app you can make use of the SwiftUI Color
extension to retrieve the colors set in the current theme.
To apply a theme to your app, simply call the set(theme:)
method of the PWThemeManager
class:
PWThemeManager.shared.set(theme: CustomTheme())
This will update the appearance of all UI elements in your app to match the specified theme.
PWTheming
is available under the MIT license.