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

Creating of VortexSystem.Settings #21

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

Conversation

disc0infern0
Copy link
Contributor

VortexSystem.Settings

[ ] Removed the configuration settings from the VortexSystem, so that the system class is now solely responsible for drawing.
[ ] Eliminated the need to ever use .makeUniqueCopy() on a Vortex System. It now returns self for backward compatibility
[ ] Settings can easily be created and modified outside of the package through use of a custom init for Settings that takes a closure to modify a given Settings struct. All existing VortexSystem presets have been recreated as Settings presets.
[ ] Initialisers: To avoid ever having to use an overlong initialiser, default settings have been added throughout. Commenting of variables has been supplemented with the default values to be used.
[ ] Removal of secondarySystems in favour of secondarySettings.
[ ] Use of VortexSystem is mostly unchanged through use of dynamicLookup ( excepting storage of secondarySystems)
[ ] New SwiftUI previews are created for each of the Settings presets. (some previews are macOS only)
[ ] VortexSystem's are only created by the VortexView or when initialising secondary systems.
[ ] The Vortex View now directly takes a Settings struct, and constructs the particle system in the init
[ ] Added automatic conformance to Equatable and Hashable for any type conforming to Identifiable.

Misc:

  • Removed manual codable settings in favour of automated conformance, made possible by adding Angle conformance to Codable.
  • Updated the Fireflies preset to allow both attraction and replusion through use of the Option key modifier on drag
  • Added default symbols to the VortexView initialiser, so that circle, triangle and sparkle can now be used without explicitly adding a trailing closure of symbols.

(This is only the second pull request I have ever created, so if there are mistakes, or breaches in etiquette, please let me know as I'm still learning how all of this works! Thankyou. )

…se;-

*   Codable: Removed manual codable settings in favour of automated conformance, made possible by adding Angle conformance to Codable.
*   Initialisers:  To avoid ever having to use an overlong initialiser, default settings have been added throughout.
*  Seperation of vortex configuraton settings to a new Struct; VortexSystem.Settings, and removal of secondarySystems in favour of secondarySettings.
* Use of VortexSystem is mostly unchanged through use of dynamicLookup
* New presets for Settings are created,  which can easily be modified by a custom init for Settings that takes a closure to modify a given Settings struct.
* New SwiftUI previews are created for each of the presets. (some previews are macOS only)
* Updated the Fireflies preset to allow both attraction and replusion through use of the Option key modifier on drag
* Eliminated the need to ever use .makeUniqueCopy() on a Vortex System. It now returns self.
* Added default symbols to the VortexView initialiser, so that  circle, triangle and sparkle can now be used without explicitly adding a trailing closure of symbols.
* Added automatic conformance to Equatable and Hashable for any type conforming to Identifiable.
@twostraws
Copy link
Owner

Thank you for this great piece of work! It looks really useful, and I'm keen to get these changes merged in so everyone can benefit from them. However, I'm not in a position to review a pull request this big – you've changed practically every file 😅

Is there any way for us to work through these in smaller, discrete chunks – if you submit a PR for one of the changes, we review it, merge it in, then repeat for another chunk? It would ensure all this functionality gets reviewed thoroughly and with all the attention it deserves. It would be easier for both of us, and I think would yield a better result for the code – if it's possible, of course.

Thank you!

@disc0infern0
Copy link
Contributor Author

disc0infern0 commented Dec 3, 2024 via email

@twostraws
Copy link
Owner

Do you have a preference as whether I start small, perhaps with default Symbols, then Automatic codable conformance, then the attraction/repulsion change to Fireflies previews, and work up to the extraction of Settings from VortexSystem?
Or the other way around, starting with the Settings change?

Thank you! That sounds very reasonable – it sounds more or less like smallest to largest, which is definitely preferable.

For each step, make sure to add a little context on why a change works well, perhaps with a before/after code snippet if you can. For example, default symbols seems like it would make a lot of code easier, but does it work well for someone importing the project through SPM?

As an aside, for the future I’d like to experiment with creating an ‘onClip’ event that would fire when a particle was removed when going out of bounds. - The idea is that we could then merge the rain and splash presets - making a splash where a rain particle clipped the lower edge. It’s perhaps gilding the lily really since the effect you already have is good, but I’m turning the idea over :).

Definitely one for a later PR 😅

I admit to being rather prone to gilding - if you have time, do have a look at another package on my GitHub page - Slider - it’s a dupe of the Apple Slider but extremely stylable, even to a radial presentation. - I started looking at Vortex because I thought it might be nice to leave a sparkly trail when moving the thumb button (that’s in progress locally)

Adding interesting features and functionality is usually great, as long as we find the balance between "making things better" and "this breaks the framework for folks who are using it."

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.

2 participants