This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
import StoreKit | |
class StoreManager: NSObject, ObservableObject, SKProductsRequestDelegate, SKPaymentTransactionObserver { | |
// setup logging | |
@ObservedObject var logStore: LogStore = LogStore() | |
let viewName = URL(fileURLWithPath: #file).lastPathComponent | |
@Published var myProducts = [SKProduct]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let player = AVPlayer(url: URL(string: videoURL.url)!) | |
VideoPlayer(player: player) | |
.onAppear { | |
playerLayer.backgroundColor = UIColor.blue.cgColor | |
addObserver(player: player) // 1 | |
} | |
.onDisappear { | |
removeObserver() | |
player.pause()// 2 | |
} |