{"id":59657,"date":"2018-05-18T08:33:29","date_gmt":"2018-05-17T23:33:29","guid":{"rendered":"https:\/\/www.softantenna.com\/wp\/?p=59657"},"modified":"2018-05-18T08:33:29","modified_gmt":"2018-05-17T23:33:29","slug":"objc2swift","status":"publish","type":"post","link":"https:\/\/softantenna.com\/blog\/objc2swift\/","title":{"rendered":"objc2swift - Objective-C\u3092Swift\u306b\u5909\u63db\u3057\u3066\u304f\u308c\u308b\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30c4\u30fc\u30eb"},"content":{"rendered":"<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2018\/05\/s_20180510_194043.jpg\" alt=\"S 20180510 194043\" title=\"s_20180510_194043.jpg\" border=\"0\" width=\"920\" height=\"596\" \/><\/p>\n<p>Apple\u306f\u73fe\u5728\u3001macOS\u3084iOS\u7528\u306e\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3059\u308b\u305f\u3081\u306b\u3001Objective-C\u3068Swift\u3068\u3044\u3046\uff12\u7a2e\u985e\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u672c\u65e5\u7d39\u4ecb\u3059\u308b\u300c<a href=\"https:\/\/github.com\/yahoojapan\/objc2swift\">objc2swift<\/a>\u300d\u306f\u3001Objective-C\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092Swift\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u308b\u3001Yahoo! JAPAN\u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u305f\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/p>\n<p>\u30c4\u30fc\u30eb\u3092\u30ed\u30fc\u30ab\u30eb\u306b\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u30c4\u30fc\u30eb\u3084Web\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30a4\u30b9\u3092\u901a\u3058\u3066\u4f7f\u7528\u3067\u304d\u308b\u307b\u304b\u3001\u30aa\u30f3\u30e9\u30a4\u30f3\u30b5\u30a4\u30c8\u3067\u76f4\u63a5\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3067\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u7279\u5fb4\u3092\u6301\u3061\u307e\u3059\u3002<\/p>\n<ul>\n<li>@interface\u3068@implementation\u3092\u30de\u30fc\u30b8\u3057\u3066Swift\u30af\u30e9\u30b9\u3092\u751f\u6210<\/li>\n<li>getter\/setter\u5b9f\u88c5\u3092\u6301\u3064\u3082\u306e\u3092\u542b\u3081\u30d7\u30ed\u30d1\u30c6\u30a3\u306e\u5909\u63db<\/li>\n<li>init\u51e6\u7406\u306e\u5909\u63db<\/li>\n<li>NSInteger\u304b\u3089Int\u3001NSLog\u304b\u3089print\u3078\u306e\u5909\u63db<\/li>\n<li>\u305d\u306e\u4ed6\u3044\u308d\u3044\u308d<\/li>\n<\/ul>\n<p>\u9577\u3044\u6b74\u53f2\u3092\u6301\u3061\u3001\u81a8\u5927\u306b\u5b58\u5728\u3059\u308bObjective-C\u306e\u8cc7\u7523\u3092\u6700\u65b0\u306eSwift\u30b3\u30fc\u30c9\u306b\u79fb\u690d\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u7528\u3059\u308b\u3068\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u3068\u3044\u3048\u308b\u3067\u3057\u3087\u3046\u3002\u4ee5\u4e0b\u4f7f\u7528\u6cd5\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h2>objc2swift\u306e\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<p>\u30ed\u30fc\u30ab\u30eb\u3067\u4f7f\u7528\u3059\u308b\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>\n$ git clone https:\/\/github.com\/yahoojapan\/objc2swift.git\n$ cd objc2swift\n$ .\/gradlew jar\n<\/pre>\n<p>\u30a8\u30a4\u30ea\u30a2\u30b9\u3092\u8a2d\u5b9a\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre>\n$ alias objc2swift='java -jar \/path\/to\/objc2swift\/build\/libs\/objc2swift-1.0.jar'\n$ objc2swift src\/test\/resources\/sample.*\n<\/pre>\n<p>\u3059\u3050\u306b\u4f7f\u3044\u305f\u3044\u5834\u5408<a href=\"http:\/\/objc2swift.yahoo-labs.jp\/\">\u30aa\u30f3\u30e9\u30a4\u30f3\u7248<\/a>\u3092\u4f7f\u7528\u3059\u308b\u306e\u304c\u4fbf\u5229\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" style=\"display:block; margin-left:auto; margin-right:auto;\" src=\"https:\/\/softantenna.com\/blog\/wp-content\/uploads\/2018\/05\/convert.jpg\" alt=\"Convert\" title=\"convert.jpg\" border=\"0\" width=\"1280\" height=\"842\" \/><\/p>\n<p>\u25b2\u5de6\u5074\u306e\u300cObjective-C\u300d\u306e\u6b04\u306b\u3001Objective-C\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002\u901a\u5e38Objective-C\u306e\u30af\u30e9\u30b9\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f.h\u3068.m\u306b\u5206\u304b\u308c\u3066\u3044\u307e\u3059\u3002\u305d\u308c\u3089\u306e\u5185\u5bb9\u3092\u9806\u306b\u8cbc\u308a\u4ed8\u3051\u308c\u3070\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u305f\u3068\u3053\u308d\u3001\u5408\u308f\u305b\u3066300\u884c\u7a0b\u5ea6\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u554f\u984c\u7121\u304f\u5909\u63db\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u305d\u306e\u307e\u307eXcode\u3067\u52d5\u304b\u305b\u308b\u308f\u3051\u3067\u306f\u306a\u304f\u3001\u624b\u52d5\u3067\u8abf\u6574\u304c\u5fc5\u8981\u306a\u90e8\u5206\u3082\u6b8b\u3063\u3066\u3044\u308b\u6a21\u69d8\u3067\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>objc2swift\u3092\u5229\u7528\u3059\u308c\u3070\u5b8c\u74a7\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u304c\u3001Objective-C\u3092Swift\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u8a18\u4e8b\u57f7\u7b46\u6642\u3001\u30c4\u30fc\u30eb\u306e\u66f4\u65b0\u306f2015\u5e74\u3067\u6b62\u307e\u3063\u3066\u3044\u3066\u3001\u751f\u6210\u3055\u308c\u308bSwift\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u300cSwift 2.x\u300d\u306e\u30ec\u30d9\u30eb\u306b\u7559\u307e\u3063\u3066\u3044\u307e\u3059\u304c\u3001Swift\u5909\u63db\u5f8c\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u3056\u3063\u304f\u308a\u8abf\u3079\u305f\u3044\u5834\u5408\u306f\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u25bc<span class=\"mybold\">\u304a\u77e5\u3089\u305b<\/span>: \u59c9\u59b9\u30b5\u30a4\u30c8<a href=\"http:\/\/www.swift-study.com\/\">Swift Study<\/a>\u3067\u306fSwift\u3092\u4f7f\u3063\u305fiOS\/Mac\u30a2\u30d7\u30ea\u958b\u767a\u60c5\u5831\u3092\u516c\u958b\u3057\u3066\u3044\u307e\u3059\u3002Swift\u958b\u767a\u60c5\u5831\u3092\u63a2\u3057\u3066\u3044\u308b\u65b9\u306f\u662f\u975e\u304a\u7acb\u3061\u5bc4\u308a\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apple\u306f\u73fe\u5728\u3001macOS\u3084iOS\u7528\u306e\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3059\u308b\u305f\u3081\u306b\u3001Objective-C\u3068Swift\u3068\u3044\u3046\uff12\u7a2e\u985e\u306e\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002 \u672c\u65e5\u7d39\u4ecb\u3059\u308b\u300cobjc2swift\u300d\u306f\u3001Objective-C\u306e\u30bd\u30fc\u30b9 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":59857,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[66],"tags":[2993,2420],"class_list":["post-59657","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webservice","tag-objectivec","tag-swift"],"_links":{"self":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/59657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/comments?post=59657"}],"version-history":[{"count":0,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/posts\/59657\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media\/59857"}],"wp:attachment":[{"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/media?parent=59657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/categories?post=59657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/softantenna.com\/blog\/wp-json\/wp\/v2\/tags?post=59657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}