{"id":2484,"date":"2016-02-27T16:31:06","date_gmt":"2016-02-27T07:31:06","guid":{"rendered":"http:\/\/redwing.moo.jp\/cocoa\/?p=2484"},"modified":"2016-02-27T16:31:06","modified_gmt":"2016-02-27T07:31:06","slug":"swift-%e3%81%a8-objective-c-%e3%81%a8%e3%81%ae%e9%80%a3%e6%90%ba%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/redwing.moo.jp\/cocoa\/archives\/2484","title":{"rendered":"Swift \u3068 Objective-C \u3068\u306e\u9023\u643a\u65b9\u6cd5"},"content":{"rendered":"<h4>Objective-C \u3067\u5b9a\u7fa9\u3057\u305f\u30af\u30e9\u30b9\u3092 Swift \u3067\u4f7f\u7528\u3059\u308b<\/h4>\n<p><strong>\u3010\u30d6\u30ea\u30c3\u30b8\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0\u3059\u308b\u3011<\/strong><\/p>\n<pre>\r\n\u30d6\u30ea\u30c3\u30b8\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u306f\uff0c<strong>$(TARGET_NAME)-Bridging-Header.h<\/strong> \u3067\uff0c\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u8ffd\u52a0\u3059\u308b\uff0e\r\n<\/pre>\n<p>Swift \u3067\u5229\u7528\u3059\u308b Objective-C \u30af\u30e9\u30b9\u3092\u30d6\u30ea\u30c3\u30b8\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8f09\u3059\u308b\uff0e<\/p>\n<p><strong>\u3010Build Settings \uff70 Objective-C Bridging Header \u3092\u8a2d\u5b9a\u3059\u308b\u3011<\/strong><br \/>\n\u30d6\u30ea\u30c3\u30b8\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u304c Swift \u306b\u53d6\u308a\u8fbc\u307e\u308c\u308b\u3088\u3046\u306b\u3001\u30bf\u30fc\u30b2\u30c3\u30c8 &#8211; Build Settings \u8a2d\u5b9a\u306b\u767b\u9332\u3059\u308b\uff0e<\/p>\n<pre>\r\nSwift Compiler - Code Generation\r\nObjective-C Bridging Header\r\n<strong>$(TARGET_NAME)\/$(TARGET_NAME)-Bridging-Header.h<\/strong> \u3068\u6307\u5b9a\u3059\u308b\uff0e\r\n<\/pre>\n<p><strong>\u3010Swift \u3067 Objective-C \u30af\u30e9\u30b9\u306e\u547c\u3073\u51fa\u3057\u65b9\u3011<\/strong><br \/>\nObjective-C\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bd\u30c3\u30c9\u306e\u5834\u5408\u3001 &#8220;textWithString:&#8221; \u306e\u3088\u3046\u306a\u30e1\u30bd\u30c3\u30c9\u306f &#8220;textWithString(str)&#8221; \u3068\u547c\u3073\u51fa\u3059\uff0e<br \/>\n&#8220;textWithString: string:&#8221; \u3068\u3044\u3046\u30e1\u30bd\u30c3\u30c9\u306e\u5834\u5408\uff0c &#8220;textWithString(str1, string:str2)&#8221; \u3068\u547c\u3073\u51fa\u3059\uff0e<\/p>\n<p>Swift \u306b\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u305f Objective-C \u30af\u30e9\u30b9\u306f\u3001\u305d\u306e\u307e\u307e\u7d99\u627f\u3057\u3066\u65b0\u3057\u3044 Swift \u30af\u30e9\u30b9\u3092\u5b9a\u7fa9\u3067\u304d\u308b\uff0e<\/p>\n<h4>Swift \u3067\u5b9a\u7fa9\u3057\u305f\u30af\u30e9\u30b9\u3092 Objective-C \u3067\u4f7f\u7528\u3059\u308b<\/h4>\n<p><strong>\u3010Swift \u30af\u30e9\u30b9\u304c\u5b9a\u7fa9\u3055\u308c\u305f\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3059\u308b\u3011<\/strong><br \/>\nSwift \u3067\u5b9a\u7fa9\u3057\u305f\u30af\u30e9\u30b9\u3092\u5229\u7528\u3059\u308b\u306b\u306f\u3001\u305d\u308c\u3092\u4f7f\u7528\u3057\u305f\u3044\u5b9f\u88c5\u30d5\u30a1\u30a4\u30eb\u5185\u306b\u3001\u6b21\u306e\u3088\u3046\u306b #import \u6587\u3092\u8a18\u8f09\u3059\u308b\uff0e<\/p>\n<pre>\r\n<strong>#import \"$(PROJECT_NAME)-Swift.h<\/strong>\r\n<\/pre>\n<p>\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u81ea\u4f53\u306b\u306f\u767b\u9332\u3055\u308c\u3066\u3044\u306a\u3044\u304c\u3001Derived Data \u306e\u4e2d\u9593\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066 &#8220;DerivedSources&#8221; \u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u81ea\u52d5\u7684\u306b\u751f\u6210\u3055\u308c\u3066\u3044\u308b\uff0e<\/p>\n<a href=\"https:\/\/twitter.com\/redwing1300?ref_src=twsrc%5Etfw\" class=\"twitter-follow-button\" data-size=\"large\" data-show-count=\"false\">Follow @redwing1300<\/a><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content --><div id=\"redwi-2872162873\" class=\"redwi- redwi-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-9652476346722993\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:block;\" data-ad-client=\"ca-pub-9652476346722993\" \ndata-ad-slot=\"\" \ndata-ad-format=\"auto\"><\/ins>\n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Objective-C \u3067\u5b9a\u7fa9\u3057\u305f\u30af\u30e9\u30b9\u3092 Swift \u3067\u4f7f\u7528\u3059\u308b \u3010\u30d6\u30ea\u30c3\u30b8\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0\u3059\u308b\u3011 \u30d6\u30ea\u30c3\u30b8\u30d8\u30c3\u30c0\u30fc\u30d5\u30a1\u30a4\u30eb\u306f\uff0c$(TARGET_NAME)-Bridging-Header.h \u3067\uff0c\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b &hellip; <a href=\"https:\/\/redwing.moo.jp\/cocoa\/archives\/2484\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,117,116,103],"tags":[],"class_list":["post-2484","post","type-post","status-publish","format-standard","hentry","category-ios","category-objective-c","category-swift","category-xcode7"],"_links":{"self":[{"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/posts\/2484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/comments?post=2484"}],"version-history":[{"count":7,"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/posts\/2484\/revisions"}],"predecessor-version":[{"id":2491,"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/posts\/2484\/revisions\/2491"}],"wp:attachment":[{"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/media?parent=2484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/categories?post=2484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redwing.moo.jp\/cocoa\/wp-json\/wp\/v2\/tags?post=2484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}