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
// | |
// CircularStepProgress2View.swift | |
// CircularStepProgressView | |
// | |
// Created by Kazi Munshimun Nabi on 7/1/24. | |
// | |
import SwiftUI | |
struct CircularStepProgress { |
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
private func change(location: CGPoint) { | |
// creating vector from location point | |
let vector = CGVector(dx: location.x, dy: location.y) | |
// geting angle in radian need to subtract the knob radius and padding | |
let angle = atan2(vector.dy - (config.knobRadius + 10), vector.dx - (config.knobRadius + 10)) + .pi/2.0 | |
// convert angle range from (-pi to pi) to (0 to 2pi) | |
let fixedAngle = angle < 0.0 ? angle + 2.0 * .pi : angle | |
// convert angle value to temperature value |
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 TemperatureControlView: View { | |
@State var temperatureValue: CGFloat = 0.0 | |
@State var angleValue: CGFloat = 0.0 | |
let config = Config(minimumValue: 0.0, | |
maximumValue: 40.0, | |
totalValue: 40.0, | |
knobRadius: 15.0, | |
radius: 125.0) | |
var body: some View { | |
ZStack { |
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 TemperatureControlView: View { | |
@State var temperatureValue: CGFloat = 0.0 | |
@State var angleValue: CGFloat = 0.0 | |
let config = Config(minimumValue: 0.0, | |
maximumValue: 40.0, | |
totalValue: 40.0, | |
knobRadius: 15.0, | |
radius: 125.0) | |
var body: some View { |
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 Config { | |
let minimumValue: CGFloat | |
let maximumValue: CGFloat | |
let totalValue: CGFloat | |
let knobRadius: CGFloat | |
let radius: CGFloat | |
} |
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 ContentView: View { | |
var body: some View { | |
ZStack { | |
Rectangle() | |
.fill(Color.init(red: 34/255, green: 30/255, blue: 47/255)) | |
.edgesIgnoringSafeArea(.all) | |
TemperatureControlView() | |
} | |
} |
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 ContentView: View { | |
var body: some View { | |
ZStack { | |
Rectangle() | |
.fill(Color.init(red: 34/255, green: 30/255, blue: 47/255)) | |
.edgesIgnoringSafeArea(.all) | |
} | |
} | |
} |
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 | |
// TemperatureControl | |
// | |
// Created by Anik on 10/9/20. | |
// | |
import SwiftUI | |
struct ContentView: View { |
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
Categories | |
Controllers | |
DataSources | |
Delegates | |
Libraries | |
Managers | |
Models | |
Resources | |
Services | |
Storyboards |