What's New

1.1.0

2022-06-15T17:35:23Z

What's Changed

  • Bump cocoapods-downloader from 1.3.0 to 1.6.3 by @dependabot in #31
  • Refactor by @fummicc1 in #32
    • Remove difference operation between Double and CGFloat
    • Remove Accurate implementation to simplify code.
    • Remove difference between HugePart and AnglePart

Full Changelog: v1.0.1...1.1.0

Images

Pod Platform Pod License Pod Version Carthage Compatible Swift Package Manager compatible

SimpleRoulette

SimpleRoulette helps you to create customizable Roulette, with SwiftUI. (Compatible with both MacOS and iOS.)

Demo

Because of GiF, demo lags

iOS MacOS

Install

Swift Package Manager

Create Package.swift and add dependency like the following.

dependencies: [
    .package(url: "https://github.com/fummicc1/SimpleRoulette.git", from: "1.1.0")
    // or
    .package(url: "https://github.com/fummicc1/SimpleRoulette.git", branch: "main")
]

Cocoapods

Create Podfile and add dependency like the following.

pod 'SimpleRoulette', '~> 1.0'

Carthage

Create Cartfile and add dependency like the following.

github "fummicc1/SimpleRoulette"

Usage

RouletteView

RouletteView confirms to View, so you can use it like the follwing.

struct ContentView: View {

    @ObservedObject var model: RouletteModel

    var body: some View {
        VStack {
            RouletteView(
                model: model
            )
        }.onAppear { model.start() } 
    }
}

// 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
        ),
    )
)

RouletteModel

RouletteModel is ObservableObject. You can observe the notification when roulette has stopped and what has been chosen via onDecide Publisher.

Usage

RouletteModel.start function immediately start roulette. By default, roulette will set when-to-stop roulette automatically whenever roulette has started.

Documentation

documentation is under construction.

Contributing

Pull requests, bug reports and feature requests are welcome 🚀

License

MIT LICENSE

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue Jun 28 2022 20:16:56 GMT-0500 (GMT-05:00)