When I build java object class in a project, build file will be created with .class extension and human unreadable; What about swift build files?
example:
car.java --> build --> car.class
what would be after build?
car.swift --> build --> ?
When I build java object class in a project, build file will be created with .class extension and human unreadable; What about swift build files?
example:
car.java --> build --> car.class
what would be after build?
car.swift --> build --> ?
The compilation process is a bit different with Swift to Java, so there isn't necessarily a direct equivalent.
As the build proceeds though each Swift file will get compiled in to an 'Object' file, ending in a .o
extension. Then once they're all built they get linked together to form the binary. If you unpick an iOS app's IPA file, you won't see the individual .o
files like how you can see the .class
files inside a Java jar file.
Mach-O format
In iOS world every sources file - .m
, .h
, .swift
are compiled into executable byte code that is understandable by CPU. These files are also called Mach object
(.o
) - ABI Mach-O
[About] file which contains nexts grouped bytes with a meta-information
This groups are repeated for every architecture(Universal library)[About]
`*.swift` -> `*.o` (Mach-O object file)
For example if you created a static library - myLibrary.a
. You can use nm
[About] command to display name list (symbol table).
nm path/myLibrary.a
As a result you will see a list of *.o
files with methods, variables names etc.
To investigate Mach-O file you can use otool
[About]
© 2022 - 2024 — McMap. All rights reserved.