Skip to content

Instantly share code, notes, and snippets.

View arbyruns's full-sized avatar

Rob Evans arbyruns

View GitHub Profile
@arbyruns
arbyruns / .swift
Created September 25, 2022 15:49
storekit
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]()
@arbyruns
arbyruns / gifsupport.swift
Created September 11, 2022 14:45
AVPlayer
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
}