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
import SwiftUI | |
import Combine | |
import class Kingfisher.KingfisherManager | |
extension Image { | |
func remoteImage(from imageURL:URL?) -> some View { | |
ModifiedContent(content: self, modifier: RemoteImage(loader: ImageLoader(imageURL))) | |
} | |
} |
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
// | |
// FavList.swift | |
// Tests | |
// | |
// Created by blaszm01 on 02/08/2019. | |
// Copyright © 2019 Mariusz Blaszczyk. All rights reserved. | |
// | |
import SwiftUI |
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
import SwiftUI | |
struct Home: View { | |
let icons = [ | |
// "moon.stars", | |
// "moon.stars.fill", | |
// "star", | |
// "star.fill", | |
// "star.lefthalf.fill", | |
// "star.circle", |
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
#if DEBUG | |
struct ContentView_Previews : PreviewProvider { | |
static var previews: some View { | |
Group { | |
ForEach(Rating.allCases.identified(by: \.self) ) { rate in | |
ContentView(rate: rate) | |
} | |
} | |
} | |
} |
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
struct ContentView : View { | |
@State var rate:Rating | |
var body: some View { | |
HStack { | |
Spacer() | |
VStack(alignment: .trailing) { | |
Text(self.rate.descriptionForRating()) | |
RatePicker(rate: $rate) | |
}.padding() | |
} |
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
enum Rating: Int,CaseIterable { | |
case noRate = 0 | |
case terrible | |
case bad | |
case hmmm | |
case good | |
case brilliant | |
func descriptionForRating() -> String { | |
switch self { |
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
struct RatePicker : View { | |
var body: some View { | |
HStack { | |
ForEach((1...5)) { id in | |
Button(action: {}) { | |
Image(systemName: "star") | |
.foregroundColor(.yellow) | |
.imageScale(.large) | |
} |