Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 1.88 KB

README.md

File metadata and controls

52 lines (33 loc) · 1.88 KB

Swift-ObjC-Cpp-ObjC-Swift

Do you want to use a project written in C/C++, ObjC/ObjC++ in your swift project? This structure is exactly what you was looking for.

Travel between C/C++ <-> ObjC/ObjC++ <-> Swift

This read me is a scratch paper, I am going to prepare more advance.

print("-- Go To ObjC --")
let calculate = CalculateWrapper()
print(calculate.multiply(5, with: 44))

print("-- Go To ObjC Then Go Back to Swift --")
calculate.greeting(withNumber: 100)

print("-- Go To ObjCpp --")
let person = PersonWrapper()
let name = person.printName()
print(name!)

print("-- Go To ObjCpp Then Go Back to Swift --")
calculate.greeting(withNumber: 500)

print("-- Go Directly to C --")
print(rectangleArea(3, 5))

print("-- Go To Cpp mm Extension Then Go Back to Swift --")
person.sum(ofThree: 3, 4, 5)

Swift-ObjC-Swift

Important Parts

Screen Shot 2022-07-26 at 20 56 14

Screen Shot 2022-07-26 at 20 56 38

Screen Shot 2022-07-26 at 20 56 54

Swift-ObjCpp-Swift

Plus Important Parts to ObjCpp

Don't forget to add this flag -fcxx-modules to .mm file Check it

Screen Shot 2022-07-27 at 23 34 32

Cpp-Swift Directly through C wrapper

Screenshot 2024-01-28 at 14 42 13