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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Types and Bridges #259

Open
khuffie opened this issue Sep 28, 2020 · 1 comment
Open

Custom Types and Bridges #259

khuffie opened this issue Sep 28, 2020 · 1 comment

Comments

@khuffie
Copy link

khuffie commented Sep 28, 2020

I'm trying to create a simple struct with some setting values:

public struct WeatherSettings: DefaultsSerializable {
	
	
	static var _defaults: DefaultsBridge<WeatherSettings> { DefaultsKeyedArchiverBridge() }
	static var _defaultsArray: DefaultsBridge<[WeatherSettings]> { DefaultsKeyedArchiverBridge() }

	let enabled:String
	let location:String
	let isCelsius:Bool
	
}

However, I keep getting this error:
"Cannot specialize non-generic type 'DefaultsBridge'"

I tried using this code from the documentation and I'm getting the same error:

struct FrogCustomSerializable: DefaultsSerializable {

    static var _defaults: DefaultsBridge<FrogCustomSerializable> { DefaultsKeyedArchiverBridge() }
    static var _defaultsArray: DefaultsBridge<[FrogCustomSerializable]> { DefaultsKeyedArchiverBridge() }

    let name: String
}

@sunshinejr
Copy link
Owner

@khuffie sorry, this paragraph in the Readme wasn't updated properly... I just created a PR with a fix for that. In the meantime, try that:

public struct WeatherSettings: DefaultsSerializable {
	static var _defaults: DefaultsKeyedArchiverBridge { DefaultsKeyedArchiverBridge() }
	static var _defaultsArray: DefaultsKeyedArchiverBridge { DefaultsKeyedArchiverBridge() }

	let enabled:String
	let location:String
	let isCelsius:Bool
	
}

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

No branches or pull requests

2 participants