I have a video player and below it I have text for a title. When you tap on the text I have it increase in Font size. But when you increase the font size it causes the video to stop playing and restart. I don't want that to happen. I want the video to play unaffected by the font increase. I'm very new to swiftUI fyi.
import SwiftUI
import AVKit
struct TEST: View {
@State private var tapped: Bool = false
@State private var draggedOffset = CGSize.zero
@State private var fontSize: CGFloat = 20 // Change Font Size
var body: some View {
VStack {
VideoPlayer(player: AVPlayer(url: URL(string: "http://www.unisonprinting.com/0celot/dune/dune.mp4")!))
.aspectRatio(3/2, contentMode: .fit)
Text ("VIDEO TITLE")
.foregroundColor(.white)
.font(.system(size: fontSize))
.onTapGesture {
if self.fontSize < 44 {
self.fontSize = self.fontSize + 12
} else {
self.fontSize = 20
}
}
}//V
}
}