Skip to content

Instantly share code, notes, and snippets.

View dropski's full-sized avatar

Łukasz dropski

View GitHub Profile
@dropski
dropski / rating.swift
Created July 3, 2023 19:48
SwiftUI Simple Partial Rating
struct ContentView: View {
@State private var sliderValue: Double = 0.0
@State private var selectedIndex: Int = -1
@State private var remainder: Double = 0.0
var body: some View {
VStack {
HStack {
ForEach(0..<5) { index in
ZStack {
Image(systemName: "star.fill")
@dropski
dropski / stars.swift
Created July 3, 2023 19:24
SwiftUI Simple Rating View
struct ContentView: View {
@State private var selectedIndex: Int = -1
var body: some View {
VStack {
HStack {
ForEach(0..<5) { index in
Image(systemName: "star.fill")
.transition(.opacity)
.foregroundColor(index <= selectedIndex ? .yellow : .gray)
.onTapGesture {
[
{
"city": "augustów",
"roasteries": [
"palarnia kawy la kafo"
]
},
{
"city": "białystok",
"roasteries": [