Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SwiftUI Color #84

Merged
merged 3 commits into from
Oct 16, 2021
Merged

Conversation

hank121314
Copy link
Collaborator

Summary

Fixes: #78.
Create a ColorBridge to support the serialization for SwiftUI Color.
Color will serialize into Data with NSColor(in iOS UIColor) bridge.

Usage

extension Defaults.Keys {
	static let color = Key<Color>("swiftui_color", default: .black)
}

struct Example: View {
	@Default(.color) var color
	
	var body: some View {
	  ColorPicker("", selection: $color, supportsOpacity: false)
	}
}

Thanks for your code review 馃槃 !

@hank121314
Copy link
Collaborator Author

// @L1cardo Could you help me to test this PR to make sure it fits your requirement? Thanks!

@L1cardo
Copy link

L1cardo commented Oct 15, 2021

// @L1cardo Could you help me to test this PR to make sure it fits your requirement? Thanks!

Yeah, sure!
I will let you know when I am done.

@L1cardo
Copy link

L1cardo commented Oct 15, 2021

@hank121314 Works perfect in my case!!!

@sindresorhus sindresorhus changed the title Add support to SwiftUI Color Add support for SwiftUI Color Oct 16, 2021
@sindresorhus sindresorhus merged commit 55f3302 into sindresorhus:main Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is it possible to support SwiftUI Color ?
3 participants