<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">Even then, that wouldn’t necessarily help in the general case. If you decode <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">{"key" : 1}</code> as <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">[String : Codable]</code>, what concrete type would <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">1</code> have? <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">Int</code>? <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">Double</code>? <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">Int8</code>? (Arguments can be made for any one of these, but the key here is that it is inherently ambiguous and there isn’t necessarily a good answer.)</p>

<p dir="auto">On 19 Oct 2017, at 12:57, David Sweeris wrote:</p>

</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><blockquote style="border-left:2px solid #777; color:#999; margin:0 0 5px; padding-left:5px; border-left-color:#999"><p dir="auto">On Oct 19, 2017, at 12:50 PM, David Baraff via swift-users &lt;swift-users@swift.org&gt; wrote:<br>
<br>
Yes; this is a case where anywhere in the code base I want to just say<br>
        struct MyNewType : Codable {<br>
                // add codable datatypes<br>
        }<br>
<br>
and don’t want/can’t always go to the centralized place to add it in.<br>
Is there some extension-like trick I can pull off that lets me spread the implementation out over different files/libraries?</p>
</blockquote><p dir="auto">Ah, ok.<br>
<br>
No, I don't think you'll be able to do that until/unless Swift gets more macro/metaprogramming features. Maybe if protocols ever get to conform to themselves? That's a common request, but implementing it is apparently beyond tricky. I'm pretty sure somebody's working on it, but "bigger fish" and all that...<br>
<br>
- Dave Sweeris</p>
</blockquote></div>
<div style="white-space:normal">
</div>
</div>
</body>
</html>