Skip to content

Conversation

@thatswiftguy
Copy link

Summary

The OrbConfiguration previously contained five boolean properties:

  • showBackground
  • showWavyBlobs
  • showParticles
  • showGlowEffects
  • showShadow

However, having multiple boolean parameters directly in the configuration felt cluttered and not in line with SwiftUI best practices.

Changes Made

Introduced View Modifiers:
The five properties have been moved from OrbConfiguration to an extension of OrbView as view modifiers. This approach provides a more declarative API for developers, aligning with SwiftUI principles and improving code readability.

The new modifiers are:

  • .enableBackground(_ enable: Bool)
  • .enableWavyBlobs(_ enable: Bool)
  • .enableParticles(_ enable: Bool)
  • .enableGlowEffects(_ enable: Bool)
  • .enableShadow(_ enable: Bool)

Example usage:

let config: OrbConfiguration =  .init(
        backgroundColors: [.red, .yellow, .green],
        glowColor: .pink,
        coreGlowIntensity: 1.2,
        speed: 60
    )

OrbView(configuration: orbConfig)
    .enableBackground(true)
    .enableWavyBlobs(false)
    .enableParticles(true)
    .enableGlowEffects(true)
    .enableShadow(false)
    .frame(width: 200, height: 200)

Updated Documentation:

The README file has been updated to reflect these changes, including examples of how to use the new modifiers.

That's it

Please review the changes and let me know if there is anything I can help you with. Thank you!

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.

1 participant