mirror of
https://github.com/ivabus/GradeMapper
synced 2024-11-21 23:55:07 +03:00
Code refactoring
This commit is contained in:
parent
5e83583583
commit
11dc8c93cf
1 changed files with 12 additions and 9 deletions
|
@ -35,21 +35,26 @@ struct ContentView: View {
|
|||
ForEach([String](coof.keys), id: \.self) {
|
||||
subjectSN in Text("\(subjectSN)")
|
||||
}
|
||||
}.pickerStyle(.wheel)
|
||||
}
|
||||
.pickerStyle(.wheel)
|
||||
VStack{
|
||||
Picker("Оценка", selection: $selectedGrade){
|
||||
ForEach(Grade.allCases, id: \.self) {
|
||||
currGrade in Text("\(currGrade.rawValue)")
|
||||
}
|
||||
}
|
||||
}.pickerStyle(.segmented).padding(.horizontal, 20)
|
||||
}.padding(.top, 100)
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.padding(.horizontal, 20)
|
||||
}
|
||||
.padding(.top, 100)
|
||||
Button ("Добавить оценку"){
|
||||
counter.multiplier = coof[selectedTypeOfGrade]!
|
||||
counter.gradesWeighted += Double(selectedGrade.rawValue) * counter.multiplier
|
||||
counter.weightsSum += counter.multiplier
|
||||
self.sr = (counter.gradesWeighted / counter.weightsSum)
|
||||
}.buttonStyle(.borderedProminent)
|
||||
}
|
||||
.buttonStyle(.borderedProminent)
|
||||
Text(String("Средний балл: \(self.sr)"))
|
||||
.fontWeight(.bold)
|
||||
Button ("Очистить"){
|
||||
|
@ -60,8 +65,6 @@ struct ContentView: View {
|
|||
}.buttonStyle(.borderedProminent)
|
||||
}
|
||||
.padding(.top, -155.0)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
|
|
Loading…
Reference in a new issue