{"id":9193,"date":"2014-07-22T13:05:25","date_gmt":"2014-07-22T17:05:25","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=9193"},"modified":"2014-08-18T00:20:31","modified_gmt":"2014-08-18T04:20:31","slug":"carbon-and-cocoa-as-a-metaphor-for-objective-c-and-swift","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/07\/22\/carbon-and-cocoa-as-a-metaphor-for-objective-c-and-swift\/","title":{"rendered":"Carbon and Cocoa as a Metaphor for Objective-C and Swift"},"content":{"rendered":"<p><a href=\"http:\/\/www.buckleyisms.com\/home\/2014\/7\/21\/carbon-and-cocoa-as-a-metaphor-for-objective-c-and-swift.html\">Michael Buckley<\/a>:<\/p>\r\n<blockquote cite=\"http:\/\/www.buckleyisms.com\/home\/2014\/7\/21\/carbon-and-cocoa-as-a-metaphor-for-objective-c-and-swift.html\"><p>But even the Cocoa version of InDesign is not a great platform citizen. OS X reports that it always uses significant energy, even when idle. Its dialog boxes are just an NSWindow with an NSView. Adobe draws text and buttons in the NSView, and tracks mouse clicks in the view manually. Since there are no NSTextFields or NSButtons, these dialogs are completely invisible to screen readers.<\/p>\r\n<p>This is in stark contrast to Lightroom, which was written with Cocoa in mind from the beginning. It's still a cross-platform app, but all of its UI elements are subclasses of Cocoa classes. The app is accessible, and it doesn't use significant energy while idle. More importantly, it can quickly adopt new features of the OS.<\/p>\r\n<p>[&#8230;]<\/p>\r\n<p>There are many features of Swift that make it a great language for Apple to write its future frameworks in. It probably won't be long until some of these frameworks start to use Swift-only features like generics. Taking full advantage of platform improvements requires adopting new frameworks, and any Objective-C programs that wants to use these frameworks will need to write adapter code in Swift.<\/p>\r\n<p>But Swift and Objective-C have different design philosophies. As time goes on, it will be harder to reconcile Objective-C's design philosophy with native Swift frameworks. In order to simply get their apps to work, developers will spend a lot of time figuring out how to refactor their existing Objective-C codebases to fit within the constraints imposed by Swift, leaving them with less time for other improvements.<\/p><\/blockquote>\r\n<p>Update (2014-07-23): <a href=\"http:\/\/lists.apple.com\/archives\/xcode-users\/2014\/Jun\/msg00024.html\">Chris Lattner<\/a>:<\/p>\r\n<blockquote cite=\"http:\/\/lists.apple.com\/archives\/xcode-users\/2014\/Jun\/msg00024.html\"><p>Swift is a new option for developing on the platform.  We have no plans to drop C, C++ or Objective-C.  If you&rsquo;re happy with them, please feel free to keep using them.<\/p><\/blockquote>\r\n<p>Of course, that&rsquo;s what Apple said about Carbon as well.<\/p>","protected":false},"excerpt":{"rendered":"<p>Michael Buckley: But even the Cocoa version of InDesign is not a great platform citizen. OS X reports that it always uses significant energy, even when idle. Its dialog boxes are just an NSWindow with an NSView. Adobe draws text and buttons in the NSView, and tracks mouse clicks in the view manually. Since there [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[447,928,38,755,69,945,30,32,966,54,901],"class_list":["post-9193","post","type-post","status-publish","format-standard","hentry","category-technology","tag-adobe","tag-lightroom","tag-apple","tag-carbon","tag-cocoa","tag-indesign","tag-mac","tag-macapp","tag-message-passing","tag-objective-c","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=9193"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9193\/revisions"}],"predecessor-version":[{"id":9219,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9193\/revisions\/9219"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=9193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=9193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=9193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}