rushelmet
rushelmet

Reputation: 305

Use Swift Library in ObjC

Is there a simple way to use a Swift library in ObjC? And if yes, how can I do it ?

Here the library I would like to use: https://github.com/matthewpalmer/Regift

By the way, if you guys know another way to convert video to animated gif in iOS. Thanks!

Upvotes: 1

Views: 1055

Answers (1)

Pang Ho Ming
Pang Ho Ming

Reputation: 1319

You should take a look of Apple's document.

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

Referring to it,

To import Swift code into Objective-C from the same target

Import the Swift code from that target into any Objective-C .m file within that target using this syntax and substituting the appropriate name: OBJECTIVE-C

import "ProductModuleName-Swift.h" The Swift files in your target will be visible in Objective-C .m files containing this import

statement. For information on using Swift from Objective-C code, see Using Swift from Objective-C.

Upvotes: 2

Related Questions