我正在尝试使用Micronaut和Kotlin序列化以下数据类
数据类Item(val name:String,val price:Double)
输出应为
import UIKit
import AVKit
import AVFoundation
class ViewController: UIViewController {
@IBOutlet weak var powerLVLlabel: UILabel!
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
func playVideo() {
guard let path = Bundle.main.path(forResource: "over 9000", ofType:"mp4") else {
debugPrint("over 9000.mp4 not found")
return
}
let player = AVPlayer(url: URL(fileURLWithPath: path))
let playerController = AVPlayerViewController()
playerController.player = player
present(playerController, animated: true)
player.play()
}
@IBAction func randomNumber(_ sender: Any) {
let randomNumber = Int.random(in: 1000...10000)
powerLVLlabel.text = String(randomNumber)
if randomNumber >= 9000 {
playVideo()
}
}
}
它从Json响应中删除了结尾的零