Skip to content

Commit 7e58ee5

Browse files
feat: updated readme with more information (#6)
1 parent 1efce86 commit 7e58ee5

File tree

1 file changed

+78
-6
lines changed

1 file changed

+78
-6
lines changed

README.md

+78-6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,85 @@
88

99
https://github.com/rafunderscore/Layers/assets/52125687/5ca08ccc-1989-4c90-8a96-683bdf59329c
1010

11-
Layers is a SwiftUI library for creating layered user interfaces.
12-
It's a simple and easy to use solution for creating smooth and performant animations between modal views.
11+
Layers is a powerful SwiftUI library designed for creating layered user interfaces, enhancing your app's user experience with smooth and performant animations between modal views.
1312

14-
---
13+
## Vision
1514

16-
### Vision
15+
While Layers isn't a perfect solution, it's a solid starting point. We believe in the power of open source and want the community to contribute and build upon Layers. If you have any suggestions or would like to contribute, please feel free to open an issue.
1716

18-
Layers as it stands is not a perfect solution, but it's a start. Which is why I'm releasing it as an open source project, for the community to build upon.
17+
## Usage
1918

20-
If you'd like to contribute to Layers feel free to open an issue if you have any suggestions.
19+
To get started with Layers:
20+
21+
1. Download the repository and check out the example.
22+
2. For integration into your own projects, copy the source folder into your project.
23+
> We have plans to convert this project into a package for easier updates in the future.
24+
25+
### Creating Layers
26+
27+
To create your own Layer, follow these steps:
28+
29+
```swift
30+
@Bindable var layers: LayerModel = .init(
31+
index: 0,
32+
max: 3,
33+
headers: [
34+
0: AnyView(ExampleHeader1()),
35+
1: AnyView(ExampleHeader2()),
36+
2: AnyView(ExampleHeader3()),
37+
],
38+
contents: [
39+
0: AnyView(ExampleContent1()),
40+
1: AnyView(ExampleContent2()),
41+
2: AnyView(ExampleContent3()),
42+
],
43+
buttons: [
44+
0: [["Cancel": "xmark.circle"], ["Continue": "checkmark.circle"]],
45+
1: [["Cancel": "xmark.circle"], ["Continue": "checkmark.circle"]],
46+
2: [["Cancel": "xmark.circle"], ["Continue": "checkmark.circle"]],
47+
]
48+
)
49+
```
50+
51+
Within your view, create content wrapped within a Layer:
52+
53+
```swift
54+
var body: some View {
55+
Layer {
56+
layers.getCurrentHeader()
57+
.id("layer.stack.header.\(layers.index)")
58+
59+
layers.getCurrentContent()
60+
.id("layer.stack.content.\(layers.index)")
61+
62+
HStack {
63+
if !layers.getCurrentButtons()[0].isEmpty {
64+
LayerButton(text: Binding.constant(layers.getCurrentButtons()[0].keys.first ?? ""),
65+
icon: Binding.constant(layers.getCurrentButtons()[0].values.first ?? ""),
66+
background: .orange)
67+
{
68+
layers.previous()
69+
}
70+
}
71+
if !layers.getCurrentButtons()[1].isEmpty {
72+
LayerButton(text: Binding.constant(layers.getCurrentButtons()[1].keys.first ?? ""),
73+
icon: Binding.constant(layers.getCurrentButtons()[1].values.first ?? ""),
74+
background: .blue)
75+
{
76+
layers.next()
77+
}
78+
}
79+
}
80+
}
81+
}
82+
```
83+
84+
This setup allows you to customize your layers extensively without diving into numerous pages or extraneous files. Future iterations will further streamline this workflow.
85+
86+
##Contributing
87+
88+
We welcome and encourage contributions to this project. If you have bug fixes or new features in mind, please create a new issue to discuss them. If you're interested in contributing code, fork the repository and submit a pull request. Make sure to document your changes and thoroughly test the project before submitting a pull request. Maintain consistency with the project's code style.
89+
90+
## Disclaimer
91+
92+
This project is open source under the MIT license, granting you full access to the source code for modifications to suit your needs. Please note that this project is in beta, so there may be bugs or areas for improvement. If you discover any issues or have suggestions, please report them by creating a new issue.

0 commit comments

Comments
 (0)