IBM Developer is your one-stop location for getting hands-on training and learning in-demand skills on relevant technologies such as generative AI, data science, AI, and open source.
Swift と Objective-C とを混在させてプログラミングしようとしたとき、Swift 標準の String 型と Objective-C 標準の NSString 型とを意識して使い分ける必要が出てきたりします。 iOS アプリ作りで必須な Foundation フレームワークも今は Objective-C で作られているので、その内部で使われる文字列型は NSString になっています。今でこそ Swift の Objective-C との相互運用性もかなり向上し、Swift で NSString を意識する機会も減った印象ですけど、それでも稀に相互変換する必要が出てきたりします。 今回はそんなことを発端に、そこから繋がる様々なことを Objective-C Bridge という観点で考察してみます。 2種類の文字列型にみる特徴と変換 まずはそんな2種類の文字列型について、
「Objective-CがSwiftに置き換わる」っていうのがピンとこないのです。 それは、Swiftそのものがオープンソースになっても、あまり変わらないと思います。 以下はすごーくざっくりした知識で書いています。 Objective-Cの歴史 そもそもObjective-Cが何なのか、あまり知られていない気がします。 超ざっくり説明すると、AppleをやめたジョブズがApple OSの「次」として、当時としては革新的なオブジェクト指向OSだったNeXTSTEPを生み出しました。NeXTSTEPの存在は後の様々なOSに影響を与えました。OSXやiOS自体、NeXTSTEPの系譜です。 NeXTSTEPはオブジェクト指向のOS・開発環境・開発言語を統合し高い生産性を実現していました。その開発言語がObjective-Cでした。NSのプレフィクスの意味が、NeXTSTEPの略称というのは、比較
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く