MagnificationGestureView.swift (717B)
1 // 2 // MagnificationGestureView.swift 3 // damus 4 // 5 // Created by user232838 on 1/5/23. 6 // 7 8 import SwiftUI 9 10 struct MagnificationGestureView: View { 11 12 @GestureState var magnifyBy = 1.0 13 14 var magnification: some Gesture { 15 MagnificationGesture() 16 .updating($magnifyBy) { currentState, gestureState, transaction in 17 gestureState = currentState 18 } 19 } 20 21 var body: some View { 22 Circle() 23 .frame(width: 100, height: 100) 24 .scaleEffect(magnifyBy) 25 .gesture(magnification) 26 } 27 } 28 29 struct MagnificationGestureView_Previews: PreviewProvider { 30 static var previews: some View { 31 MagnificationGestureView() 32 } 33 }