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

How do I implement UnmarshalPlist? #14

Open
henrahmagix opened this issue Sep 22, 2018 · 0 comments
Open

How do I implement UnmarshalPlist? #14

henrahmagix opened this issue Sep 22, 2018 · 0 comments

Comments

@henrahmagix
Copy link

I'm a bit confused about how to use/implement UnmarshalPlist. What am I meant to pass to the function func (i interface{}) error? When I pass the struct, I get an infinite loop.

My use case is I'm trying to unmarshal an iOS Workflow plist, but I'm stuck on the key WFTextActionText that can either be <string> or <dict>. I thought I could implement UnmarshalPlist on the struct that holds WFTextActionText to determine whether to set a WFTextActionTextString or WFTextActionTextDict value.

Thanks in advanced =)

Example plist and Go file: https://gist.github.com/henrahmagix/7b8909a02dcd326aa29dcd46be1dd8c6

Example string:

<key>WFTextActionText</key>
<string>City 1, state 1,country 1</string>

Example dict:

<key>WFTextActionText</key>
<dict>
	<key>Value</key>
	<dict>
		<key>attachmentsByRange</key>
		<dict>
			<key>{13, 1}</key>
			<dict>
				<key>Type</key>
				<string>Variable</string>
				<key>VariableName</key>
				<string>State</string>
			</dict>
			<key>{23, 1}</key>
			<dict>
				<key>Type</key>
				<string>Variable</string>
				<key>VariableName</key>
				<string>Country</string>
			</dict>
			<key>{5, 1}</key>
			<dict>
				<key>Type</key>
				<string>Variable</string>
				<key>VariableName</key>
				<string>City</string>
			</dict>
		</dict>
		<key>string</key>
		<string>City= State= Country=</string>
	</dict>
	<key>WFSerializationType</key>
	<string>WFTextTokenString</string>
</dict>
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

1 participant