<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NSCoding &#8211; Frankis Website</title>
	<atom:link href="https://fpposchmann.de/tag/nscoding/feed/" rel="self" type="application/rss+xml" />
	<link>https://fpposchmann.de</link>
	<description>Consulting &#38; Software</description>
	<lastBuildDate>Wed, 11 Dec 2019 14:54:05 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.1</generator>

<image>
	<url>https://fpposchmann.de/wp-content/uploads/2023/08/cropped-Bildschirmfoto-2023-08-07-um-14.23.35-32x32.png</url>
	<title>NSCoding &#8211; Frankis Website</title>
	<link>https://fpposchmann.de</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>LinkedList: NSCoding protocol</title>
		<link>https://fpposchmann.de/linkedlist-nscoding-protocol/</link>
					<comments>https://fpposchmann.de/linkedlist-nscoding-protocol/#respond</comments>
		
		<dc:creator><![CDATA[Frank-Peter Poschmann]]></dc:creator>
		<pubDate>Tue, 10 Sep 2019 14:31:30 +0000</pubDate>
				<category><![CDATA[Swift]]></category>
		<category><![CDATA[Codable]]></category>
		<category><![CDATA[linked list]]></category>
		<category><![CDATA[NSCoding]]></category>
		<category><![CDATA[reference type]]></category>
		<category><![CDATA[serialization]]></category>
		<guid isPermaLink="false">https://www.fpposchmann.de/?p=467</guid>

					<description><![CDATA[In my previous post I’ve explained that the new Codable protocol of Swift 4 has some problems with references to objects (i.e. class instances). Or, better said, the two implementations of coders available

• ProperListEncoder/PropertyListDecoder
• JSONEncoder/JSONDecoder

have this problem: they expand all references to new objects and create doublets if references in the object tree occur more than once for a single object. In the case of loops in the object tree (references of objects to each other) the encoding leads to an endless loop.

The old NSKeyedArchiver/NSKeyedUnarchiver of the Objective C-world do not have this problem: they respect references and restore them correctly at unarchiving. So, I want to implement this old way, i.e. the NSCoding protocol in my LinkedList as well.]]></description>
		
					<wfw:commentRss>https://fpposchmann.de/linkedlist-nscoding-protocol/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>LinkedList: Codable protocol and references</title>
		<link>https://fpposchmann.de/linkedlist-codable-protocol-and-references/</link>
					<comments>https://fpposchmann.de/linkedlist-codable-protocol-and-references/#respond</comments>
		
		<dc:creator><![CDATA[Frank-Peter Poschmann]]></dc:creator>
		<pubDate>Fri, 23 Aug 2019 13:37:39 +0000</pubDate>
				<category><![CDATA[Swift]]></category>
		<category><![CDATA[Codable]]></category>
		<category><![CDATA[data structure]]></category>
		<category><![CDATA[linked list]]></category>
		<category><![CDATA[NSCoding]]></category>
		<category><![CDATA[reference type]]></category>
		<category><![CDATA[serialization]]></category>
		<guid isPermaLink="false">https://www.fpposchmann.de/?p=462</guid>

					<description><![CDATA[Maybe you have read my series of posts about LinkedLists. It was great fun for me to put these things together, but recently, I stumbled over a problem with serialisation, esp. the Codable protocol and references to objects. In Swift 5 there are two Encoder/Decoder pairs available:PropertyListEncoder/PropertyListDecoderJSONEncoder/JSONDecoderIt turns out that these encoders are not really suitable for archiving object graphs because they expand all references to objects, i.e. put the objects instead of the references in the archive. If you have a simple tree of objects and you do not care about doublets that may be fine but as soon as you have loops in your object graph you are in trouble. Encoding such a graph with these two encoders lead to an endless loop. This may happen quite frequently; just think about delegation where you typically have references of the delegate and its master against each other.]]></description>
		
					<wfw:commentRss>https://fpposchmann.de/linkedlist-codable-protocol-and-references/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Update: Serialising enums and structs in Swift 4</title>
		<link>https://fpposchmann.de/update-serialising-enums-and-structs-in-swift-4/</link>
					<comments>https://fpposchmann.de/update-serialising-enums-and-structs-in-swift-4/#respond</comments>
		
		<dc:creator><![CDATA[Frank-Peter Poschmann]]></dc:creator>
		<pubDate>Mon, 13 Nov 2017 14:34:21 +0000</pubDate>
				<category><![CDATA[Swift]]></category>
		<category><![CDATA[associated value]]></category>
		<category><![CDATA[Codable]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[NSCoding]]></category>
		<category><![CDATA[serialization]]></category>
		<category><![CDATA[struct]]></category>
		<guid isPermaLink="false">http://www.fpposchmann.de/?p=259</guid>

					<description><![CDATA[So, now Swift 4 is here and things are changing. One of the big improvements of Swift 4 is the incorporation of serialisation for classes, structs and enums. In contrast to the previous versions which rely on the old NSObject/NSCoding mechanisms the new Coding protocol is not restricted to classes only. And even better, if you do not have special needs the compiler will synthesise for you the needed functions as we will see later.]]></description>
		
					<wfw:commentRss>https://fpposchmann.de/update-serialising-enums-and-structs-in-swift-4/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Making structs serializable</title>
		<link>https://fpposchmann.de/making-structs-serializable/</link>
					<comments>https://fpposchmann.de/making-structs-serializable/#respond</comments>
		
		<dc:creator><![CDATA[Frank-Peter Poschmann]]></dc:creator>
		<pubDate>Sat, 10 Jun 2017 14:54:28 +0000</pubDate>
				<category><![CDATA[Swift]]></category>
		<category><![CDATA[NSCoding]]></category>
		<category><![CDATA[serialization]]></category>
		<category><![CDATA[struct]]></category>
		<guid isPermaLink="false">http://www.fpposchmann.de/?p=216</guid>

					<description><![CDATA[Just for completeness I'd like to show in this post how to make structs serializable in the same manner as enums. Again, we transform the struct to a dictionary of NSCoding compliant types and give it to an NSCoder (e.g. NSKeyedArchiver) for coding. The other way round we get the decoded dictionary and initialize the desired struct with it.]]></description>
		
					<wfw:commentRss>https://fpposchmann.de/making-structs-serializable/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Serializing enums with associated values</title>
		<link>https://fpposchmann.de/serializing-enums-with-associated-values/</link>
					<comments>https://fpposchmann.de/serializing-enums-with-associated-values/#respond</comments>
		
		<dc:creator><![CDATA[Frank-Peter Poschmann]]></dc:creator>
		<pubDate>Mon, 29 May 2017 08:54:18 +0000</pubDate>
				<category><![CDATA[Swift]]></category>
		<category><![CDATA[associated value]]></category>
		<category><![CDATA[enum]]></category>
		<category><![CDATA[NSCoding]]></category>
		<category><![CDATA[serialization]]></category>
		<guid isPermaLink="false">http://www.fpposchmann.de/?p=198</guid>

					<description><![CDATA[A problem arises when we want to store enums (maybe as part of the model) on a file or want to send it over a network, let’s say: want to serialize the enum. Although the primitive types as Int and String conform to the NSCoding protocol as well as collections of those types (e.g. Arrays and Dictionaries) enums and structs don’t. And since they are not classes we can also not implement the NSCoding protocol for them. For simple enums we can use its raw values for coding, but that’s not possible for enums with associated values.]]></description>
		
					<wfw:commentRss>https://fpposchmann.de/serializing-enums-with-associated-values/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
