Detect if iOS App is written in Swift
Asked Answered
S

2

5

Im developing a tool that tries to dump header classes for a jailbroken device on an App. I'm using Clutch, but sometimes Clutch fails to some newer apps, I'm thinking of integrating some tools other than Clutch. So, I need to determine at first if the binary is written in Swift, so that I can switch to the right tool to execute.

My question is, Is there a way, like a command tool to determine if an iOS App Binary is written in Swift? Is there really much difference in how the binary is built when it's in Swift compare to just Obj-C?

Subplot answered 1/10, 2015 at 7:51 Comment(4)
Some apps are built with a mix of swift and objective-c. What are you gonna do then?Pineal
You have no right whatsoever to dump header files for any application that I have written and that is on the app store.Lynnette
this is a pentesting tool that determines if an app is vulnerable to some common security issues. see www.idbtool.comSubplot
thanks Nicolas, I think my priority right now is, as long as I know if an app is written with Swift code in it then.Subplot
H
9

You can use nm tool to print app symbol table. If you search for swift, for example using grep:

nm YourApp | grep swift

It will print something like this (and many more):

U __swift_FORCE_LOAD_$_swiftFoundation

For an 100% Objective-C app the result will be empty. However, you can't tell if the code is 100% Swift because for mixed objc + swift apps the result will be similar to a swift app.

Holle answered 1/10, 2015 at 8:26 Comment(1)
I think this one is a best fit solution. Thanks AdamSubplot
A
7

Inside the .app file there is a _CodeSignature folder. Inside there is a CodeResources file. If you open that as text you will see that it contains Frameworks/libswiftCore.dylib

I believe this indicates that it has been built with swift.

Active answered 1/10, 2015 at 8:13 Comment(1)
if iOS13 up, it not's contains Frameworks/libswiftCore.dylibIntranuclear

© 2022 - 2024 — McMap. All rights reserved.