Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
fummicc1 committed Feb 14, 2023
1 parent 99bde57 commit b435752
Show file tree
Hide file tree
Showing 1,491 changed files with 1,632 additions and 1,532 deletions.
Binary file not shown.
92 changes: 71 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Create `Package.swift` and add dependency like the following.

```swift
dependencies: [
.package(url: "https://github.com/fummicc1/SimpleRoulette.git", from: "1.2.0")
.package(url: "https://github.com/fummicc1/SimpleRoulette.git", from: "1.3.0")
// or
.package(url: "https://github.com/fummicc1/SimpleRoulette.git", branch: "main")
]
Expand All @@ -39,7 +39,7 @@ dependencies: [
Create `Podfile` and add dependency like the following.

```ruby
pod 'SimpleRoulette', '~> 1.2'
pod 'SimpleRoulette', '~> 1.3'
```

### Carthage
Expand All @@ -54,57 +54,115 @@ github "fummicc1/SimpleRoulette"

### RouletteView

All you need to know is just `RouletteView` and `PartData`.
`RouletteView` confirms to `View`, so you can use it like the follwing.

````swift
```swift
struct ContentView: View {

@ObservedObject var model: RouletteModel
var body: some View {
RouletteView(
parts: partDatas
)
.startOnAppear(automaticallyStopAfter: 5) { part in
guard let text = part.content.text else {
return
}
title = text
}
}

var partDatas: [PartData] {
[
PartData(
content: .label("Swift"),
area: .flex(3),
fillColor: Color.red
),
PartData(
content: .label("Kotlin"),
area: .flex(1),
fillColor: Color.purple
),
PartData(
content: .label("JavaScript"),
area: .flex(2),
fillColor: Color.yellow
),
PartData(
content: .label("Dart"),
area: .flex(1),
fillColor: Color.green
),
PartData(
content: .label("Python"),
area: .flex(2),
fillColor: Color.blue
),
PartData(
content: .label("C++"),
area: .degree(60),
fillColor: Color.orange
),
]
}
}
````

## RouletteModel

If you want to pause / restart roulette. Please use `RouletteModel` like the following.

```swift
struct ContentView: View {

@StateObject var model: RouletteModel

var body: some View {
VStack {
RouletteView(
model: model
)
}.onAppear { model.start(speed: .random()) }
RouletteView(model: model)
}.onAppear {
model.start()
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
model.pause() // you can pause
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
model.restart() // you can restart
}
}
}
}
}

// Call ContentView
ContentView(
model: RouletteModel(
PartData(
index: 0,
content: .label("Swift"),
area: .flex(3),
fillColor: Color.red
),
PartData(
index: 1,
content: .label("Kotlin"),
area: .flex(1),
fillColor: Color.purple
),
PartData(
index: 2,
content: .label("JavaScript"),
area: .flex(2),
fillColor: Color.yellow
),
PartData(
index: 3,
content: .label("Dart"),
area: .flex(1),
fillColor: Color.green
),
PartData(
index: 4,
content: .label("Python"),
area: .flex(2),
fillColor: Color.blue
),
PartData(
index: 5,
content: .label("C++"),
area: .degree(60),
fillColor: Color.orange
Expand All @@ -113,14 +171,6 @@ ContentView(
)
```

### RouletteModel

RouletteModel is `ObservableObject`. You can observe the event that roulette has been stopped and what is the stop via `onDecide` Publisher.

## Usage

`RouletteModel.start` function immediately start roulette. If you would stop roulette automatically, please specify the duration in seconds of rotation at `automaticallyStopAfter: Double?` parameter. Default value of `automaticallyStopAfter` is nil which means that roulette continues rotating unless you call `RouletteModel.stop` method.

## Documentation

- [Documentation](https://fummicc1.github.io/SimpleRoulette/documentation/simpleroulette)
Expand Down
6 changes: 3 additions & 3 deletions SimpleRoulette.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Pod::Spec.new do |spec|
#

spec.name = "SimpleRoulette"
spec.version = "1.2.0"
spec.summary = "Create Roulette with ease."
spec.version = "1.3.0"
spec.summary = "SwiftUI library to create Roulette with ease."

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
Expand Down Expand Up @@ -81,7 +81,7 @@ Pod::Spec.new do |spec|
# Supports git, hg, bzr, svn and HTTP.
#

spec.source = { :git => "https://github.com/fummicc1/SimpleRoulette.git", :tag => "1.2.0" }
spec.source = { :git => "https://github.com/fummicc1/SimpleRoulette.git", :tag => "1.3.0" }


# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
Expand Down
2 changes: 1 addition & 1 deletion docs/data/documentation/simpleroulette.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data/documentation/simpleroulette/content.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"languages":["swift"],"platforms":["macOS"]}]}],"schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"variants":[{"paths":["\/documentation\/simpleroulette\/content"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content","interfaceLanguage":"swift"},"topicSections":[{"title":"Enumeration Cases","identifiers":["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/label(_:)"]},{"title":"Instance Properties","identifiers":["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/text","doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/view"]}],"kind":"symbol","metadata":{"fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"title":"Content","roleHeading":"Enumeration","role":"symbol","symbolKind":"enum","externalID":"s:14SimpleRoulette7ContentO","modules":[{"name":"SimpleRoulette"}],"navigatorTitle":[{"kind":"identifier","text":"Content"}]},"hierarchy":{"paths":[["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette"]]},"references":{"doc://SimpleRoulette/documentation/SimpleRoulette/Content/label(_:)":{"role":"symbol","title":"Content.label(_:)","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"label"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"},{"kind":"text","text":")"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/label(_:)","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/label(_:)"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content/text":{"role":"symbol","title":"text","fragments":[{"kind":"keyword","text":"var"},{"kind":"text","text":" "},{"kind":"identifier","text":"text"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"},{"kind":"text","text":"?"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/text","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/text"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content/custom(_:)":{"role":"symbol","title":"Content.custom(_:)","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/custom(_:)"},"doc://SimpleRoulette/documentation/SimpleRoulette":{"role":"collection","title":"SimpleRoulette","abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content/view":{"role":"symbol","title":"view","fragments":[{"kind":"keyword","text":"var"},{"kind":"text","text":" "},{"kind":"identifier","text":"view"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/view","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/view"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content":{"role":"symbol","title":"Content","fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"Content"}],"url":"\/documentation\/simpleroulette\/content"}}}
{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"languages":["swift"],"platforms":["macOS"]}]}],"schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"variants":[{"paths":["\/documentation\/simpleroulette\/content"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content","interfaceLanguage":"swift"},"topicSections":[{"title":"Enumeration Cases","identifiers":["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/label(_:)"]},{"title":"Instance Properties","identifiers":["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/text","doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/view"]}],"kind":"symbol","metadata":{"fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"title":"Content","roleHeading":"Enumeration","role":"symbol","symbolKind":"enum","externalID":"s:14SimpleRoulette7ContentO","modules":[{"name":"SimpleRoulette"}],"navigatorTitle":[{"kind":"identifier","text":"Content"}]},"hierarchy":{"paths":[["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette"]]},"references":{"doc://SimpleRoulette/documentation/SimpleRoulette/Content/view":{"role":"symbol","title":"view","fragments":[{"kind":"keyword","text":"var"},{"kind":"text","text":" "},{"kind":"identifier","text":"view"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/view","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/view"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content/label(_:)":{"role":"symbol","title":"Content.label(_:)","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"label"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"},{"kind":"text","text":")"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/label(_:)","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/label(_:)"},"doc://SimpleRoulette/documentation/SimpleRoulette":{"role":"collection","title":"SimpleRoulette","abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content/custom(_:)":{"role":"symbol","title":"Content.custom(_:)","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/custom(_:)"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content/text":{"role":"symbol","title":"text","fragments":[{"kind":"keyword","text":"var"},{"kind":"text","text":" "},{"kind":"identifier","text":"text"},{"kind":"text","text":": "},{"kind":"typeIdentifier","text":"String","preciseIdentifier":"s:SS"},{"kind":"text","text":"?"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/text","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/text"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content":{"role":"symbol","title":"Content","fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"Content"}],"url":"\/documentation\/simpleroulette\/content"}}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"languages":["swift"],"platforms":["macOS"]}]}],"schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"variants":[{"paths":["\/documentation\/simpleroulette\/content\/custom(_:)"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","interfaceLanguage":"swift"},"kind":"symbol","metadata":{"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"title":"Content.custom(_:)","roleHeading":"Case","role":"symbol","symbolKind":"case","externalID":"s:14SimpleRoulette7ContentO6customyAC7SwiftUI7AnyViewVcACmF","modules":[{"name":"SimpleRoulette"}]},"hierarchy":{"paths":[["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette","doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content"]]},"references":{"doc://SimpleRoulette/documentation/SimpleRoulette/Content/custom(_:)":{"role":"symbol","title":"Content.custom(_:)","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/custom(_:)"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content":{"role":"symbol","title":"Content","fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"Content"}],"url":"\/documentation\/simpleroulette\/content"},"doc://SimpleRoulette/documentation/SimpleRoulette":{"role":"collection","title":"SimpleRoulette","abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette"}}}
{"primaryContentSections":[{"kind":"declarations","declarations":[{"tokens":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"languages":["swift"],"platforms":["macOS"]}]}],"schemaVersion":{"major":0,"minor":3,"patch":0},"sections":[],"variants":[{"paths":["\/documentation\/simpleroulette\/content\/custom(_:)"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","interfaceLanguage":"swift"},"kind":"symbol","metadata":{"fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"title":"Content.custom(_:)","roleHeading":"Case","role":"symbol","symbolKind":"case","externalID":"s:14SimpleRoulette7ContentO6customyAC7SwiftUI7AnyViewVcACmF","modules":[{"name":"SimpleRoulette"}]},"hierarchy":{"paths":[["doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette","doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content"]]},"references":{"doc://SimpleRoulette/documentation/SimpleRoulette/Content/custom(_:)":{"role":"symbol","title":"Content.custom(_:)","fragments":[{"kind":"keyword","text":"case"},{"kind":"text","text":" "},{"kind":"identifier","text":"custom"},{"kind":"text","text":"("},{"kind":"typeIdentifier","text":"AnyView","preciseIdentifier":"s:7SwiftUI7AnyViewV"},{"kind":"text","text":")"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content\/custom(_:)","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette\/content\/custom(_:)"},"doc://SimpleRoulette/documentation/SimpleRoulette":{"role":"collection","title":"SimpleRoulette","abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette","kind":"symbol","type":"topic","url":"\/documentation\/simpleroulette"},"doc://SimpleRoulette/documentation/SimpleRoulette/Content":{"role":"symbol","title":"Content","fragments":[{"kind":"keyword","text":"enum"},{"kind":"text","text":" "},{"kind":"identifier","text":"Content"}],"abstract":[],"identifier":"doc:\/\/SimpleRoulette\/documentation\/SimpleRoulette\/Content","kind":"symbol","type":"topic","navigatorTitle":[{"kind":"identifier","text":"Content"}],"url":"\/documentation\/simpleroulette\/content"}}}
Loading

0 comments on commit b435752

Please sign in to comment.