{"id":11477,"date":"2015-06-12T13:10:08","date_gmt":"2015-06-12T17:10:08","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=11477"},"modified":"2015-07-27T23:44:37","modified_gmt":"2015-07-28T03:44:37","slug":"swift-libraries-not-included-in-ios-9-or-el-capitan","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/06\/12\/swift-libraries-not-included-in-ios-9-or-el-capitan\/","title":{"rendered":"Swift Libraries Not Included in iOS 9 or El Capitan"},"content":{"rendered":"<p><a href=\"https:\/\/forums.developer.apple.com\/message\/9714\">Chris Lattner<\/a> (contra <a href=\"http:\/\/mjtsai.com\/blog\/2015\/05\/23\/ios-9-and-mac-os-x-10-11-rumors\/\">Mark Gurman<\/a>):<\/p>\r\n<blockquote cite=\"https:\/\/forums.developer.apple.com\/message\/9714\"><p>There were no public statements that Swift 2.0 would eliminate that requirement (just some rumor sites claiming that) and in fact Swift 2 will continue to require the standard library in your app.<\/p>\r\n<p>We are interested in making Swift ABI stable going forward, but will need more time to settle things out. In particular, we want to make sure that we get to incorporate ideas and feedback from the open source community before locking things down.<\/p><\/blockquote>\r\n<p>This is really good news for Swift in the long term. However, it does make deployment less attractive in the short term. Gurman says that the libraries for an application take up 8 MB. I found that a Hello World command-line tool is 3.6 MB. Regardless, this gets multiplied by the number of binaries in your application: background helper app, XPC service, Spotlight importer, Quick Look plug-in, Automator action, command-line tool, etc.<\/p>\r\n<p>Update (2015-06-15): It is <a href=\"https:\/\/twitter.com\/danielpunkass\/status\/610473805149024256\">not always the case<\/a> that there will be duplicate copies of the Swift libraries for each binary. For example, a <tt>.appex<\/tt> bundle will automatically link to the libraries in its containing app. Xcode 6 does not seem to do this automatically for other bundle types, but in theory a future version could. Any binary such as a command-line tool that could be moved, relative to the main application, probably needs to embed its own copy of the libraries.<\/p>\r\n<p>Update (2015-07-27): <a href=\"http:\/\/pewpewthespells.com\/blog\/swift_and_objc.html\">Sam Marshall<\/a>:<\/p>\r\n<blockquote cite=\"http:\/\/pewpewthespells.com\/blog\/swift_and_objc.html\">\r\n<p>There is a build setting named <code>EMBEDDED_CONTENT_CONTAINS_SWIFT<\/code> which stores a boolean value. There is an <a href=\"https:\/\/developer.apple.com\/library\/ios\/qa\/qa1881\/_index.html\">Apple Q&amp;A document<\/a> that describes how to use this, however there are some assumptions made as to how this flag is to be used.<\/p>\r\n<p>When enabling the <code>EMBEDDED_CONTENT_CONTAINS_SWIFT<\/code> flag on a target, a new step is added to the build process. This step runs the target\u2019s build product through a tool called <code>swift-stdlib-tool<\/code>, which parses the binary header to get the list of linked dependencies (frameworks\/libraries). It will then check the paths of these linked dependencies to see if any of them contain references to the Swift runtime libraries.<\/p>\r\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Chris Lattner (contra Mark Gurman): There were no public statements that Swift 2.0 would eliminate that requirement (just some rumor sites claiming that) and in fact Swift 2 will continue to require the standard library in your app. We are interested in making Swift ABI stable going forward, but will need more time to settle [&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":[4],"tags":[31,1137,30,1199,71,901],"class_list":["post-11477","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-ios","tag-ios-9","tag-mac","tag-mac-os-x-10-11","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11477","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=11477"}],"version-history":[{"count":4,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11477\/revisions"}],"predecessor-version":[{"id":11834,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/11477\/revisions\/11834"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=11477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=11477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=11477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}