Stepper ile Artırma
Stepper ile değerleri artırıp azaltın.
Stepper ile Artırma, CoddyKit'te ücretsiz bir SwiftUI Academy dersidir. Bu, 4 dersinin 3. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, SwiftUI Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. SwiftUI Academy kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Meet the Stepper
A Stepper shows minus and plus buttons to nudge a value up or down. It is ideal for quantities like item counts. ➕
Stepper Holds a Number
Like Slider, a Stepper edits a number. Tapping plus increases it and tapping minus decreases it by one step.
@State private var count = 1Bind to State
Connect the value with the dollar sign binding and give it a label. SwiftUI handles the plus and minus taps for you.
Stepper("Quantity", value: $count)Set a Range
Pass an in range to clamp the value. The buttons disable automatically when you hit the minimum or maximum.
Stepper("Count", value: $count, in: 0...10)Choose the Step Size
Add a step to change how much each tap moves the value, like jumping by five instead of one.
Stepper("Score", value: $count, in: 0...100, step: 5)Show the Value
You usually want to display the current number. Interpolate it into the label so users see the count update.
Stepper("Items: \(count)", value: $count)Custom Increment Actions
Need full control? Use the onIncrement and onDecrement closures to run your own logic on each tap.
Stepper("Adjust") {
count += 2
} onDecrement: {
count -= 2
}Stepper in a Form
Drop a Stepper into a Form row for a tidy settings look, the same way Toggle and Slider fit there.
Form {
Stepper("Servings", value: $count)
}A Richer Label
The label can be any view via the closure form, so you can pair text with an icon for clarity.
Stepper(value: $count) {
Label("Cups", systemImage: "cup.and.saucer")
}React to Changes
Other views update automatically when the count changes. Here a Text repeats based on the value.
Text(String(repeating: "⭐️", count: count))The Full View
Everything together: a clamped Stepper with a step plus a label that shows the live count.
struct CartView: View {
@State private var count = 1
var body: some View {
Stepper("Qty: \(count)", value: $count, in: 1...9)
}
}Quick Check
What happens when a Stepper value reaches the top of its range?
Recap
A Stepper nudges a number with plus and minus, supports an in range and step, and clamps at the edges. ➕➖
Sıkça Sorulan Sorular
“Stepper ile Artırma” dersi ücretsiz mi?
Evet — “Stepper ile Artırma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve SwiftUI Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. SwiftUI Academy kursu toplamda 4 dersten oluşur.
“Stepper ile Artırma” dersinde ne öğreneceğim?
Stepper ile değerleri artırıp azaltın. SwiftUI Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
SwiftUI Academy öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te SwiftUI Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 3. dersidir.
“Stepper ile Artırma” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu SwiftUI Academy dersinde kod yazıp çalıştırabilir miyim?
Evet. Her SwiftUI Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Toggle ile Açma ve Kapatma
- Slider ile Değer Seçme
- Stepper ile Artırma
- Picker ile Seçenek Belirleme