tomvanzummeren/TZStackView

Works only with Swift?

davidfrasch opened this issue · 5 comments

I guess this fantastic Project will only works with Swift? Because my whole project is written in Objective c and i don´t have the time to change everything to Swift in the near future.

Swift can be used together with Objective C. Swift is supported from iOS 7 and up!

Yeah but only when i create a new class, and my existing Classes with Objective c have to be re created isn't it?

No, that is not how it works. You can literally just have both Swift and Objective C classes in your project and they can use each other. From Objective C you can just instantiate the TZStackView like this:

TZStackView *stackView = [[TZStackView alloc] initWithArrangedSubviews: @[view1, view2, view3]]

You do have to add an import to your Objective C class like this:

#import "YourProject-Swift.h"

Of course you have to replace "YourProject" with your actual project name. This is a header-file that is auto-generated when you use Swift. The header file will contain all the Swift classes you want to use in Obj-C format. With this trick Obj-C and Swift are compatible.

Let me know if you need help with this some more.

Oh i didn´t know that this is possible, thank you very much, that helps me a lot!! :)

You're welcome! Let me know if you run into any trouble!