Skip to content

Instantly share code, notes, and snippets.

View kazimunshimun's full-sized avatar

Kazi Munshimun Nabi kazimunshimun

  • CHECK24 Finanzservice GmbH
  • Munich, Germany
View GitHub Profile
//
// CircularStepProgress2View.swift
// CircularStepProgressView
//
// Created by Kazi Munshimun Nabi on 7/1/24.
//
import SwiftUI
struct CircularStepProgress {
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
@kazimunshimun
kazimunshimun / ContentView_5.swift
Last active September 10, 2020 20:13
SwiftUI Circular Slider Parts
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 {
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 {
@kazimunshimun
kazimunshimun / ContentView_3.swift
Created September 10, 2020 19:58
SwiftUI Circular Slider parts
struct Config {
let minimumValue: CGFloat
let maximumValue: CGFloat
let totalValue: CGFloat
let knobRadius: CGFloat
let radius: CGFloat
}
@kazimunshimun
kazimunshimun / ContentView_2.swift
Created September 10, 2020 19:54
SwiftUI Circular Slider parts
struct ContentView: View {
var body: some View {
ZStack {
Rectangle()
.fill(Color.init(red: 34/255, green: 30/255, blue: 47/255))
.edgesIgnoringSafeArea(.all)
TemperatureControlView()
}
}
@kazimunshimun
kazimunshimun / ContentView_1.swift
Last active September 10, 2020 19:53
SwiftUI Circular Slider
struct ContentView: View {
var body: some View {
ZStack {
Rectangle()
.fill(Color.init(red: 34/255, green: 30/255, blue: 47/255))
.edgesIgnoringSafeArea(.all)
}
}
}
@kazimunshimun
kazimunshimun / ContentView.swift
Created September 10, 2020 19:25
SwiftUI Circular Slider
//
// ContentView.swift
// TemperatureControl
//
// Created by Anik on 10/9/20.
//
import SwiftUI
struct ContentView: View {
Categories
Controllers
DataSources
Delegates
Libraries
Managers
Models
Resources
Services
Storyboards