<div dir="ltr">Howdy.<div><br></div><div>I&#39;ve been building (on Linux) the latest off of master for Swift and the accompanying swift-corelibs-foundation.  I can see where the great renaming is in full swing and have been updating my code accordingly.</div><div><br></div><div>One area where I&#39;m a bit confused is with the new API for NotificationCenter and Notification.</div><div><br></div><div>In the past bare strings were acceptable for <font face="monospace, monospace">postNotificationName</font> and <font face="monospace, monospace">addObserverForName</font>.  Yet now constructing a <font face="monospace, monospace">Notification</font> and <font face="monospace, monospace">Notification.Name</font> seem to be a bit unwieldy.  Example:</div><div><br></div><div><div><font face="monospace, monospace">let ConnectedNotification    = Notification(name:Notification.Name(rawValue:&quot;ConnectedNotification&quot;))</font></div></div><div><br></div><div><div>That seems to be quite convoluted and I&#39;m not sure why there isn&#39;t a convenience init that allows for</div><div><br></div><div><div><font face="monospace, monospace">let ConnectedNotification    = Notification(name:&quot;ConnectedNotification&quot;)</font></div></div><div><br></div><div>Then, the APIs for post and observe seem to be mismatched:</div><div><br></div><div><font face="monospace, monospace">NotificationCenter.defaultCenter().postNotification(ConnectedNotification)</font></div><div><br></div><div>vs. </div><div><br></div><div><font face="monospace, monospace">NotificationCenter.defaultCenter().addObserverForName(ConnectedNotification.name)</font></div><div><br></div><div>I would think an <font face="monospace, monospace">addObserverForNotification</font> would be more appropriate here.</div><div><br></div><div>Finally, combining topics a bit, but they are related:</div><div><font face="monospace, monospace"><br></font></div><div><div><font face="monospace, monospace">let ConnectedNotification    = Notification(name:Notification.Name(rawValue:&quot;ConnectedNotification&quot;))</font></div><div><font face="monospace, monospace">let DisconnectedNotification = Notification(name:Notification.Name(rawValue:&quot;DisconnectedNotification&quot;))</font></div></div><div><br></div><div>These notifications are for the same API, so I&#39;m assuming I&#39;m &quot;doing this wrong&quot; and that the more Swifty way would be too put these in a struct or enum, so I&#39;m curious as to what folks recommend.</div><div><br></div><div>Thanks!</div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Joseph Bell<br><div><a href="http://dev.iachieved.it/iachievedit/" target="_blank">http://dev.iachieved.it/iachievedit/</a></div><div>@iachievedit</div></div></div></div></div>
</div></div>