I’m trying to port some mac/iOS swift code over to also compile and run on linux. However one of the files I’m working with references PropertyListDecoder in order to decode some propertylist data we have in our library, and it’s failing to compile since PropertyListDecoder doesn’t appear to be implemented in the corelibs-foundation project. Is this an oversight, or intentional? Are there any workarounds I can do (short of re-encoding our data in JSON which i’d prefer not to do) to get access to property list decoding on linux?
On 16 November 2017 at 20:54, Kevin Lundberg via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:
I’m trying to port some mac/iOS swift code over to also compile and run on linux. However one of the files I’m working with references PropertyListDecoder in order to decode some propertylist data we have in our library, and it’s failing to compile since PropertyListDecoder doesn’t appear to be implemented in the corelibs-foundation project. Is this an oversight, or intentional? Are there any workarounds I can do (short of re-encoding our data in JSON which i’d prefer not to do) to get access to property list decoding on linux?
Thank you! I found this shortly before your message, and I’m working on that right now in my project (and it is definitely not a simple copy paste but so far it seems manageable).
···
--
Kevin Lundberg
On Nov 16, 2017, at 4:12 PM, Ian Partridge <ian@poncho.org.uk> wrote:
Hi Kevin,
It's unintentional, in the sense that noone has done the work yet to
implement the PropertyListDecoder in corelibs-foundation.
On 16 November 2017 at 20:54, Kevin Lundberg via swift-corelibs-dev > <swift-corelibs-dev@swift.org> wrote:
I’m trying to port some mac/iOS swift code over to also compile and run on linux. However one of the files I’m working with references PropertyListDecoder in order to decode some propertylist data we have in our library, and it’s failing to compile since PropertyListDecoder doesn’t appear to be implemented in the corelibs-foundation project. Is this an oversight, or intentional? Are there any workarounds I can do (short of re-encoding our data in JSON which i’d prefer not to do) to get access to property list decoding on linux?
May/may not be useful - unfortunately couldn’t get it working on Linux so had to close.
···
Sent from my iPhone
On 16 Nov 2017, at 21:18, Kevin Lundberg via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:
Thank you! I found this shortly before your message, and I’m working on that right now in my project (and it is definitely not a simple copy paste but so far it seems manageable).
--
Kevin Lundberg
On Nov 16, 2017, at 4:12 PM, Ian Partridge <ian@poncho.org.uk> wrote:
Hi Kevin,
It's unintentional, in the sense that noone has done the work yet to
implement the PropertyListDecoder in corelibs-foundation.
On 16 November 2017 at 20:54, Kevin Lundberg via swift-corelibs-dev >> <swift-corelibs-dev@swift.org> wrote:
I’m trying to port some mac/iOS swift code over to also compile and run on linux. However one of the files I’m working with references PropertyListDecoder in order to decode some propertylist data we have in our library, and it’s failing to compile since PropertyListDecoder doesn’t appear to be implemented in the corelibs-foundation project. Is this an oversight, or intentional? Are there any workarounds I can do (short of re-encoding our data in JSON which i’d prefer not to do) to get access to property list decoding on linux?
@pvieito I just tried to use your Shortcut code and I could build it, but strangely, it generates errors when I put that module in my project:
.../PropertyListCoder.swift:266:20: error: type '_PlistKeyedEncodingContainer<K>' does not conform to protocol 'KeyedEncodingContainerProtocol'
fileprivate struct _PlistKeyedEncodingContainer<K : CodingKey> : KeyedEncodingContainerProtocol {
^
.../PropertyListCoder.swift:333:26: note: candidate has non-matching type '<K> () -> Encoder'
public mutating func superEncoder() -> Encoder {
^
.../PropertyListCoder.swift:337:26: note: candidate has non-matching type '<K> (forKey: _PlistKeyedEncodingContainer<K>.Key) -> Encoder' (aka '<τ_0_0> (forKey: τ_0_0) -> Encoder')
public mutating func superEncoder(forKey key: Key) -> Encoder {
^
Swift.KeyedEncodingContainerProtocol:38:19: note: protocol requires function 'superEncoder()' with type '() -> Encoder'; do you want to add a stub?
mutating func superEncoder() -> Encoder
^
Swift.KeyedEncodingContainerProtocol:39:19: note: protocol requires function 'superEncoder(forKey:)' with type '(_PlistKeyedEncodingContainer<K>.Key) -> Encoder'; do you want to add a stub?
mutating func superEncoder(forKey key: Self.Key) -> Encoder
^
.../PropertyListCoder.swift:342:20: error: type '_PlistUnkeyedEncodingContainer' does not conform to protocol 'UnkeyedEncodingContainer'
fileprivate struct _PlistUnkeyedEncodingContainer : UnkeyedEncodingContainer {
^
.../PropertyListCoder.swift:412:26: note: candidate has non-matching type '() -> Encoder'
public mutating func superEncoder() -> Encoder {
^
Swift.UnkeyedEncodingContainer:38:19: note: protocol requires function 'superEncoder()' with type '() -> Encoder'; do you want to add a stub?
mutating func superEncoder() -> Encoder
^
.../Config/PropertyListCoder.swift:541:34: error: argument type '_PlistEncoder' does not conform to expected type 'Encoder'
try value.encode(to: self)
^~~~
as! Encoder
I am a bit puzzled by the difference of behavior. Any idea about what I could be doing wrong ?
Thanks !
Update: It seems it has something to do with some conflict with my code. If I put it in a different package and namespace, it works fine.