Blueprints @objc
vexelgray opened this issue · comments
Can i use this library in Objective C?
@vexelgray Good question, I haven't tried it out. I'm guessing that we'll have to add some annotations in order to expose everything that is needed into Objective-C land. You can give it a go and see, if there are any changes that needs implementing just hit me up about it... or even better, make a PR and I'll review it :)
@zenangst i don't know where is the problem exactly, but blueprints dont allow initialize the class in objective-C as you can see in this screenshot:
@vexelgray the required initializer for that layout looks like this:
required public init(
itemsPerRow: CGFloat? = nil,
itemSize: CGSize = CGSize(width: 50, height: 50),
estimatedItemSize: CGSize = .zero,
minimumInteritemSpacing: CGFloat = 0,
minimumLineSpacing: CGFloat = 10,
sectionInset: EdgeInsets = EdgeInsets(top: 0, left: 0, bottom: 0, right: 0),
stickyHeaders: Bool = false,
stickyFooters: Bool = false,
animator: BlueprintLayoutAnimator = DefaultLayoutAnimator()
)
A bit unsure how that would translate into Obj-C but it might give you a clue to what you need to do to initialize it. The animator might cause issues as its a Swift class and does not conform to NSObject
.
@zenangst i saw the init method in the swift class, but the problem is init method can't be accessed through objective-C.
@vexelgray super true, give me a few minutes and I'll see if I can't make a branch for you to try it out.
I'll keep you posted!
@vexelgray hello again... I've pushed a branch and created a PR, mind trying it out to see how it works for you?
The branch is feature/objc-support
and you can find the PR here #28
No worries mate, thanks for helping me test it ❤️
Just let me know if there anything else that is missing or maybe something that you'll like to collaborate on. I've spent a lot of time to optimize the framework for performance etc but it would be neat to re-focus a bit and maybe add some more features etc. All depends on the features, it covers a lot out of the box already :) Anyways, cheers and enjoy those blueprint layouts 😁