VTAcknowledgementsViewController icon indicating copy to clipboard operation
VTAcknowledgementsViewController copied to clipboard

Why 2 libraries (Objective-C/Swift)?

Open iDevelopper opened this issue 5 years ago • 9 comments

Not an issue.

Are there any particular reasons for maintaining the two repos?

https://github.com/vtourraine/VTAcknowledgementsViewController

https://github.com/vtourraine/AcknowList

iDevelopper avatar Feb 02 '21 15:02 iDevelopper

Historical reasons, I guess? 😅

The library started as ObjC. Then I tried to re-implement it in Swift when it was introduced. Both projects are still being used, therefore both are still being maintained. Some people want ObjC only, others Swift only, and there are good reasons for both.

The sane thing would be to retire one of them, and just maintain one. I’ll probably do that at one point.

PS: I’m thinking about adding a SwiftUI implementation now. Maybe just as an “add on” to the Swift version, but that’s a different discussion anyway...

vtourraine avatar Feb 02 '21 16:02 vtourraine

First, I think we could expose the swift framework to Objective-C. What about this?

iDevelopper avatar Feb 02 '21 16:02 iDevelopper

Using @objc annotations? That seems like a good idea (I just hope we’re not overlooking some kind of obscure feature or optimization only available in Swift-only libraries). Feel free to open a pull request on AcknowList (or at least an Issue to call this out).

vtourraine avatar Feb 02 '21 20:02 vtourraine

I don't understand why but it already works without using @objC annotations!

AcknowListTestObjC.zip

AcknowListTestObjCSPM.zip

iDevelopper avatar Feb 03 '21 06:02 iDevelopper

Interesting. Maybe because they‘re subclasses of Objective-C classes, so there’s some inherited compatibility?

But still, only the [[class alloc] init] initializer is available. And objects like Acknow and the parser are not available at all. So there’s still work to be done to have AcknowList really Objective-C compatible.

vtourraine avatar Feb 03 '21 08:02 vtourraine

Exact, you are right! Ouf, because I did not understand! Not all functions need to be compatible? Do you need the parser to be public? Or internal?

iDevelopper avatar Feb 03 '21 08:02 iDevelopper

Everything that is open/public in Swift should also be accessible from Objective-C, if we want it to be fully compatible.

vtourraine avatar Feb 03 '21 08:02 vtourraine

I don't think so. We need to expose only the functions that a user will use in an Objective-C project.

iDevelopper avatar Feb 03 '21 08:02 iDevelopper

I understand your point of view, but some developers will want to have access to everything that is already accessible in Swift, especially if we want to retire the Objective-C library later on.

vtourraine avatar Feb 03 '21 09:02 vtourraine