iosobjective-cswiftjailbreakcydia

Detect if iOS App is written in Swift


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?


Solution

  • 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.