일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- Kuring
- Flutter
- Swfit
- MVVM
- rxcocoa
- CollectionView
- Xcode
- designpattern
- raywenderlich
- realm
- 프로그래머스
- UIKit
- SwiftUI
- TCA
- combine
- visionOS
- BOJ
- XCTest
- swift
- reactorkit
- Lv2
- 백준
- arkit
- node.js
- WWDC24
- ios
- SnapKit
- RxSwift
- 패스트캠퍼스
- tableView
Archives
- Today
- Total
lgvv98
SwiftUI .swipeActions not working 본문
[SwiftUI] .swipeActions not working
When using swipeActions, it does not work if you place a other content instead of a Button.
❌ It does not work
@State private var showTranslation = false
var body: some View {
List(0..<5) {
Text("\($0)")
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
Image(systemName: "plus") // ❌
}
}
.listStyle(.plain)
.translationPresentation(
isPresented: $showTranslation,
text: "테스트"
)
}
}
✅ It works
@State private var showTranslation = false
var body: some View {
List(0..<5) {
Text("\($0)")
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
// ✅
Button {
showTranslation.toggle()
} label: {
Image(systemName: "plus")
}
}
}
.listStyle(.plain)
.translationPresentation(
isPresented: $showTranslation,
text: "테스트"
)
}
}
'apple > Docs, iOS, Swift' 카테고리의 다른 글
Swift @TaskLocal (3) | 2024.08.28 |
---|---|
Swift KeyPath 정리 (0) | 2024.08.28 |
iOS Translation Framework (0) | 2024.08.28 |
swift @_spi (System Programming Interfaces) (0) | 2024.08.20 |
CloudKit 정리 코드 예제 #3 (0) | 2024.08.18 |
Comments