Lindenmayer

0.8.0

A swift library that implements a parametric Lindenmayer system and related SwiftUI views for presentation of the results of your systems.
heckj/Lindenmayer

What's New

0.8.0

2024-04-13T19:45:41Z

Swift6 compatibility/strict concurrency update

When I originally created this package, async/await wasn't yet available. In supporting strict concurrency and the upcoming Swift 6 release, I've updated the Swift language support to require at least Swift 5.8, and changed the API to utilize async/await on the modules that produce results, with either a custom definition file for the Lindenmayer system, or leveraging the stochastic (random choices) features available in some of the Lindenmayer systems.

Known Issues

  • there's one remaining Swift6 compatibility issue, complaining that I SwiftUI's ScrollViewProxy isn't Sendable, even with a @preconcurrency import into the view that uses it (this is in the LindenmayerViews module). I suspect it will be marked as Sendable in the future, but am hesitant to apply my own assertions on that front, so I'm leaving it alone as the final remaining Swift6 compatibility issue.

What's Changed

  • use @_exported to expand SwiftUI Angle to be easier to find by @heckj in #39
  • Experimental skip synthesized symbols by @finestructure in #40
  • updating swift tooling to prep for Swift 6 concurrency updates by @heckj in #41
  • Concurrency lockdown by @heckj in #42

New Contributors

Full Changelog: 0.7.3...0.8.0

Lindenmayer

Build Platforms Swift 5.5 License Twitter

The package provides a library you can expand upon to develop your own Lindenmayer systems, directly in the Swift programming language. While the package includes a number example L-systems, the primary intent is to allow you to create L-systems with rules and modules that you define. This implementation provides support for context sensitive, and parametric grammars when creating your L-system.

The library provides 2D and 3D representation rendering of a current L-system states, including some SwiftUI views that you can use to display either 2D or 3D results:

The repository has Discussions enabled if you have questions, as well as issues logged for planned improvements.

Contributions are welcome - as discussion, feedback, questions, or code.

Inspiration

A combination of influences led to this development, initial as an experiment and general exploration. One part was the lindenmayer swift playground by @henrinormak, which implements a great single-character representation which is perfect for exploring fractal systems. That, in turn, was built on the work of Aristid Lindenmayer in the book The Algorithmic Beauty of Plants. The research that Aristid Lindenmayer started continues to be expanded by Professor Przemyslaw Prusinkiewicz with generous publications of research papers on the site Algorithmic Botany.

A couple of the papers expand on the tooling to create and evaluate L-systems, and their advances allow for interesting new capabilities to be expressed in the L-systems:

The features that I was most interested in leveraging:

  • Parameters within an L-system's modules and exposing them to grammar evaluation and production choices (parametric L-systems).
  • The introduction of random values with those parameters (stochastic grammars).

While this project can be implemented using an interpreter, I wanted to see how far I could leverage the Swift language. This project attempts to follow in the conceptual footsteps of the L+C language to create a mechanism to create L-systems that compile down to machine code for efficiency of execution.

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

Last updated: Wed Jul 10 2024 00:24:24 GMT-0900 (Hawaii-Aleutian Daylight Time)