Movatterモバイル変換


[0]ホーム

URL:


Monday,March5,2018

First-Class Swift API for Objective-C Frameworks

Marcin Krzyżanowski:

In Objective-C, it’s possible to store a block as anid type, e.g. in a collection likeNSDictionary<String *, id>. However,that’s a trap. If we store a Swift closure in the imported dictionary type, it will crash at the time we access the value.

There is a workaround, but it has to be done on the Swift side. Declare the closure type with the@convention(block) and use it as a type[…]

[…]

The non-system framework Objective-CNSUInteger is imported asUInt. That’s not very consistent with the Swift concept of having anInt as the ultimate integer type. The conversation about ifNSUInteger should be automatically imported as anInt isalready older than a year, and we’re still looking for a better solution in this area.

[…]

API Notes is a textual file with a set of metadata interpreted by Swift’s Clang Importer without the need to rebuild the binary.

[…]

@_exported will make an imported module re-exported as if the imported symbols were part of the intermediate module. The intermediate module is logically placed between two other modules, which is why it’s called an overlay framework: It overlays the@_exported modules.

CommentsRSS ·Twitter

Leave a Comment

  

Black Friday
Blog
Archives
Tag Cloud
Top Posts

Recently Updated
RSS Feed ·Comments
Mastodon ·Twitter
Apple News
Trackback

Support this site viaPatreon.

Try my Mac apps:

DropDMGDropDMGDropDMG
EagleFilerEagleFilerEagleFiler
SpamSieveSpamSieveSpamSieve
ToothFairyToothFairyToothFairy
Copyright © 2000–2025Michael Tsai.

[8]ページ先頭

©2009-2025 Movatter.jp