This file contains hidden or 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 Needle: Shape { | |
func path(in rect: CGRect) -> Path { | |
var path = Path() | |
path.move(to: CGPoint(x: 0, y: rect.height/2)) | |
path.addLine(to: CGPoint(x: rect.width, y: 0)) | |
path.addLine(to: CGPoint(x: rect.width, y: rect.height)) | |
return path | |
} | |
} |
This file contains hidden or 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 GaugeView: View { | |
func colorMix(percent: Int) -> Color { | |
let p = Double(percent) | |
let tempG = (100.0-p)/100 | |
let g: Double = tempG < 0 ? 0 : tempG | |
let tempR = 1+(p-100.0)/100.0 | |
let r: Double = tempR < 0 ? 0 : tempR | |
return Color.init(red: r, green: g, blue: 0) | |
} | |
This file contains hidden or 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 GaugeView: View { | |
func colorMix(percent: Int) -> Color { | |
let p = Double(percent) | |
let tempG = (100.0-p)/100 | |
let g: Double = tempG < 0 ? 0 : tempG | |
let tempR = 1+(p-100.0)/100.0 | |
let r: Double = tempR < 0 ? 0 : tempR | |
return Color.init(red: r, green: g, blue: 0) | |
} | |
This file contains hidden or 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
// | |
// ContentView.swift | |
// GaugeViewDemo | |
// | |
// Created by Prafulla Singh on 7/6/20. | |
// Copyright © 2020 Prafulla Singh. All rights reserved. | |
// | |
import SwiftUI |
This file contains hidden or 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 ContentView: View { | |
var body: some View { | |
NavigationView { | |
NavigationLink(destination: DetailView()) { | |
Text("Simple Text Button") // set .primaryButton() to update | |
} | |
.navigationBarTitle("Welcome") | |
} | |
} |
This file contains hidden or 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
// | |
// Toast.swift | |
// ThemingSwiftUI | |
// | |
// Created by Prafulla Singh on 6/6/20. | |
// Copyright © 2020 Prafulla Singh. All rights reserved. | |
// | |
//Picked: https://stackoverflow.com/questions/56550135/swiftui-global-overlay-that-can-be-triggered-from-any-view | |
import SwiftUI |
This file contains hidden or 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 Foundation | |
import SwiftUI | |
struct PrimaryHeader: ViewModifier { | |
func body(content: Content) -> some View { | |
content | |
.font(Font.system(size: Matrix.headerPrimarySize, | |
weight: .bold, | |
design: .default)) | |
.foregroundColor(Color.textHeaderPrimary) |
This file contains hidden or 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
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). |
This file contains hidden or 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 Foundation | |
import CoreGraphics | |
class Matrix { | |
static let headerPrimarySize: CGFloat = 36 | |
static let headerSecondarySize: CGFloat = 27 | |
static let paragraphSize: CGFloat = 18 | |
static let stackViewSpacing: CGFloat = 20 | |
static let cornerRadius: CGFloat = 12 |