-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from chenhaiteng/refactor/documentation-works
- Loading branch information
Showing
39 changed files
with
556 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## ArcStack | ||
|
||
### Preview: | ||
ArcStack is based on the [Layout](https://developer.apple.com/documentation/swiftui/layout) protocol. It arranges views along the given arc. | ||
|
||
![Demo](../../Sources/Rings/Documentation.docc/Resources/ArcStack.gif) | ||
|
||
### Usage: | ||
Create an ArcStack | ||
```swift | ||
ArcStack { | ||
Image(systemName:"star") | ||
Text("arc view 1") | ||
Text("arc view 2") | ||
// other views... | ||
} | ||
``` | ||
|
||
Create an ArcStack which is located on top leading corner: | ||
```swift | ||
ArcStack(anchor: .topLeading) { | ||
// put views | ||
} | ||
``` | ||
|
||
Layout views in an ArcStack with specified range: | ||
```swift | ||
ArcStack(range: 0...0.5) { // layout views in half of the arc | ||
// put views | ||
} | ||
``` | ||
|
||
For other usages, please refer to the preview in source code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## RingStack | ||
|
||
### Preview: | ||
RingStack is based on the [Layout](https://developer.apple.com/documentation/swiftui/layout) protocol. It arranges views along a circle. | ||
|
||
![Demo](../../Sources/Rings/Documentation.docc/Resources/RingStack.gif) | ||
|
||
### Usage: | ||
Following code snippets placing views in a circle which radius depends on its frame: | ||
```swift | ||
RingStack { | ||
Image(systemName: "star") | ||
Image(systemName: "moon") | ||
Image(systmeName: "sun.min") | ||
} | ||
``` | ||
|
||
To specify those views into a fixed sized circle: | ||
```swift | ||
RingStack(radius: 100.0) { | ||
Image(systemName: "star") | ||
Image(systemName: "moon") | ||
Image(systmeName: "sun.min") | ||
}.frame(width: 300.0, height: 300.0) | ||
``` | ||
|
||
To layout views with offsets: | ||
```swift | ||
RingStack(center: UnitPoint(x:0.7, y:0.0)) { | ||
// placing views here | ||
} | ||
``` | ||
|
||
Apply rotation on whole RingStack: | ||
```swift | ||
RingStack(phase: Angle(degrees: 45.0)) { | ||
// placing views here | ||
} | ||
``` | ||
|
||
Also, it can support [ForEach](https://developer.apple.com/documentation/swiftui/foreach) syntax as following: | ||
```swift | ||
@State var numberCount: Int | ||
RingStack { | ||
ForEach(1..<numberCount, id: \.self) { num in | ||
Text("\(num)") | ||
} | ||
} | ||
``` | ||
For more usages, please refer to the preview in source code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.