# Swift and Objective-C tweak supporting

With increment of swift, it's not ridiculous that using swift when you do some jailbreak development. If the tweak can get a better UI and I can code easier, there is no reason to refuse swift.

But one thing we should care about is that, Xcode 6 (and later) will link swift's dylib something like @rpath/libswiftDarwin.dylib.

That means if you didn't put those dylib files into a directory named Frameworks which right under your executable file's directory, it will just crash when you try to launch them.

Thoes dylibs take about 6.3MB. Not so large? Think about how much space would been wasted if one day most tweaks use swift and ObjectiveC?

So, why not put those files into a fixed directory?

/Library/Support/Swift/Frameworks/

And when you do development, ssh to your device

$cd PATH_TO_EXECUTABLE_PATH$ ln -s /Library/Support/Swift/Frameworks Frameworks

As for distribution,
(in your postinst file)
ln -s /Library/Support/Swift/Frameworks PATH_TO_EXECUTABLE_PATH/Frameworks

(in your prerm file)
rm PATH_TO_EXECUTABLE_PATH/Frameworks

If you understand what do I mean, you can add a dependence com.0xBBC.swift-support

I've already submit this to Bigboss, and I believe this package will be available soon.   For alternately, I also provide this package in my personal Cydia repository:

http://apt.0xbbc.com

(In System section, named Swift Frameworks)

Unfortunately,

I realize this is needed for your tweak. We had another developer looking into this issue. like you are.

However, distributing apple's files is something we wish not to do; this idea is not compatible with our guidelines.

Please make your simple tweak again using not swift frameworks; or wait until we can develop a more proper solution for this. Without a solution, using swift is not practical, so I suspect you will have to wait.

Optimo - Repo Maintainer
http://thebigboss.org
So I will distribute this on my Cydia repository.

P.S：

Command line tool doesn't need link with swift files. It embedded.
Logos Hook needs to link. (If you don't do this, it won't crash either load)
Captain Hook is the same as Logos Hook (Crashes if not linked)

But you have to link binary with CoreGraphics.framework in Build Phases.

Error messages if you didn't link.

Nov 23 22:54:43 0xBBC-iPod-touch vsassetd[4697] <Error>: MS:Error: dlopen(/Library/MobileSubstrate/DynamicLibraries/swift-mix-objc-logos.dylib, 9): Library not loaded: @rpath/libswiftCore.dylib
Referenced from: /Library/MobileSubstrate/DynamicLibraries/swift-mix-objc-logos.dylib
声明: 本文为0xBBC原创, 转载注明出处喵～