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

Improve project's modularization. #54

Closed
oscbyspro opened this issue Mar 5, 2022 · 5 comments
Closed

Improve project's modularization. #54

oscbyspro opened this issue Mar 5, 2022 · 5 comments
Labels
enhancement improvements n' stuff
Milestone

Comments

@oscbyspro
Copy link
Owner

oscbyspro commented Mar 5, 2022

The current structure cannot export text styles, as it would create cyclical dependencies. It is also ill suited for supporting additional platforms such as macOS, because DiffableTextViews becomes too crowded. A solution is to restructure the project as

Level 0: 
- DiffableTextKit

Level 1:
- NumericTextStyles
- PatternTextStyles
- DiffableTextViews_iOS
- DiffableTextViews_macOS

Level 2:
- DiffableTextViews [exports]

where the dependencies are Level 0 —> Level 1 —> Level 2 and the current DiffableTextViews target is split into two new targets: DiffableTextKit (models) and DiffableTextViews_iOS. A new DiffableTextViews then exports based on platform.

@oscbyspro oscbyspro added the enhancement improvements n' stuff label Mar 5, 2022
@oscbyspro oscbyspro added this to the v3.0.0 milestone Mar 5, 2022
@oscbyspro
Copy link
Owner Author

oscbyspro commented Mar 6, 2022

It looks like it is not possible hide DiffableTextKit while using @_exported. Level 1 would be imported by import Level 2, while Level 0 would be importable as a separate module. It is not ideal, but it is also not a deal breaker. This realization is a product of testing .library(name: "Level 2", targets: ["Level 2"]).

@oscbyspro
Copy link
Owner Author

oscbyspro commented Mar 7, 2022

While trying to implement this I’ve been leaning towards:

Level 0: 
- DiffableTextKit

Level 1: 
- DiffableTextStyles_Numeric
- DiffableTextStyles_Pattern

Level 2:
- DiffableTextStyles [wrappers] [exports Level 1]

Level 3:
- DiffableTextViews_iOS
- DiffableTextViews_macOS

Level 4:
- DiffableTextViews [exports Level 2 and Level 3].

To avoid circular dependencies, in this case, UIKitDiffableTextStyle conformances must be made in DiffableTextViews_iOS.

@oscbyspro
Copy link
Owner Author

It should now be restructured similar to this in the dev_milestone_v3.0.0 branch.

@oscbyspro
Copy link
Owner Author

oscbyspro commented Mar 7, 2022

Maybe it needs to be restructured so styles have access to platform protocols (UIKitDiffableTextStyle). Thinking about it…

Level 0: 
- DiffableTextKit

Level 1:
- DiffableTextViews_iOS
- DiffableTextViews_macOS

Level 2: 
- DiffableTextStyles_Numeric
- DiffableTextStyles_Pattern
- DiffableTextStyles_Wrapper

Level 3:
- DiffableTextStyles [exports Level 2]

Level 4:
- DiffableTextViews  [exports Level 1 & 3].

@oscbyspro
Copy link
Owner Author

The above structure works well enough and makes it straight forward to, for example, add additional styles or a macOS target—each in a separate namespace and with explicit dependencies. It is a bit silly to have two targets that only exports, but it is what it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements n' stuff
Projects
None yet
Development

No branches or pull requests

1 participant