mindz-eye / MYTableViewIndex

A pixel perfect replacement for UITableView section index, written in Swift
MIT License
523 stars 52 forks source link

Some public var-s of TableViewIndex not visible from Objective-C #13

Closed dgarkusha closed 6 years ago

dgarkusha commented 7 years ago

Hi,

Thanks for the nice library!

I would like to report one small issue that I found while integrating the lib into an Objective-C project. The problem is that indexInset, indexOffset and itemSpacing var-s are missing in auto-generated header and can not be accessed from Objective C. At the same time, when you edit library code and try to specify a different name for any of those properties via @objc(...), compiler starts showing "Property cannot be marked @objc because its type cannot be represented in Objective-C" error.

I made a small investigation and found that indexInset and indexOffset were visible correctly until 510e329ac18bba7c4900150aa2988f94ff1e3721. So, the problem appeared as soon as those struct-s became implicitly unwrapped optionals. If I now simply change them back in a way that they wouldn't be optionals anymore, the problem disappears. If on your opinion this is ok (maybe there is a better solution...), I'll do a merge request.

backofthecup commented 7 years ago

Very nice control. Any chance the Objective C issues will be worked out soon?

mindz-eye commented 7 years ago

I tried to express a null_resettable behavior, but as it turned out, Xcode header generator yields _Null_unspecified for implicitly unwrapped optionals instead. And it obviously can not import optional structs :( To achieve the desired behavior we need to make them non-optionals and add an explicit resetFont/Inset/Offset/Spacing methods. A bit ugly solution though.

If on your opinion this is ok (maybe there is a better solution...), I'll do a merge request.

Yeah, I think reverting to non-optionals is ok for now.