Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splitting the package into modules #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DmitriyHolovnia
Copy link

Splitting makes it possible to use only the necessary modules in the project. There is a plan to add a module for SwiftUI.

Copy link
Contributor

@OleksandrKulyk OleksandrKulyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I think about it, the less likely it seems that someone will want not to include one of these two modules, given that we already use both Foundation and UIKit on most of our apps.
It feels more beneficial to divide the existing package into modules by their purpose, not related libraries. Here is my draft on how files can be grouped:

  • CellsHelpers - ReusableCell.swift, UICollectionView+extensions.swift, UITableView+extensions.swift
  • CollectionsHelpers - Array+extensions.swift, Collection+indexPath
  • LayoutHelpers - NSLayoutConstrain+extensions, UILayoutPriority+extensions.swift, UIView+extensions.swift
  • UIHelpers - NibInitializable.swift, CACornerMask+extensions.swift, roundCornersContinuously method from UIView+extensions.swift

And don't forget to update the tests as well.
Anyway, huge thanks for this initiative and SwiftUI preparations 💯

@scaaales
Copy link
Collaborator

scaaales commented Jun 7, 2022

I don't think dividing by purpose is a great idea. If package is added without Package.swift file (with Xcode build in Package Dependencies tab inside project settings) only way to change selected target's is to delete and add package again, to my knowledge. So, i think, it is better so have as few modules as possible. Modules based on main framework extended in module is a great idea.
But i agree that tests should be fixed. I believe run_tests.yml need to be updated for that.

@OleksandrKulyk
Copy link
Contributor

@scaaales Good point about the number of modules. Indeed, we might end up with a ton of them.
As for the need to re-add the dependency to include the new module - it is true. I don't think there is a way for a seamless update even for these two modules split, so we will probably need to bump the major version.

@DmitriyHolovnia As for the changes I suggested (TLDL, feel free to ignore them):
Right now (UIKit-only), IMHO, it is tempting to go with purpose-based separation. However, considering further plans for SwiftUI - I can see why you may want to have a separate Foundation module. Such an approach will allow the following combinations for two different UI styles:
Foundation + UIKit,
Foundation + SwiftUI.

@DmitriyHolovnia
Copy link
Author

@scaaales you can add targets here:
Screenshot 2022-06-10 at 5 29 04 PM
@AlexanderKulyk I like your idea. I will work on it soon.

@scaaales scaaales mentioned this pull request Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants