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 UIKit | |
import AVFoundation | |
class ViewController: UIViewController { | |
private var player: AVPlayer! | |
private var playerLayer: AVPlayerLayer! | |
override func viewDidLoad() { | |
super.viewDidLoad() |
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
scrollView.flashScrollIndicators() |
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
func start() { | |
let userInfo = ["name": "Jerry"] | |
timer = Timer.scheduledTimer(timeInterval: 1, | |
target: self, | |
selector: #selector(update(timer:)), | |
userInfo: userInfo, | |
repeats: true) | |
} | |
@objc func update(timer: Timer) { |
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
var timer: Timer? | |
var timerCount = 0 | |
func start() { | |
timer = Timer.scheduledTimer(timeInterval: 1, | |
target: self, | |
selector: #selector(update(timer:)), | |
userInfo: nil, | |
repeats: true) | |
} |
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
func stop() { | |
timer?.invalidate() | |
} |
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
var timer: Timer? | |
func start() { | |
timer = Timer.scheduledTimer(timeInterval: 1, | |
target: self, | |
selector: #selector(update(timer:)), | |
userInfo: nil, | |
repeats: true) | |
} |
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
func update(timer: Timer) { | |
print("更新") | |
} |
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 UIKit | |
import Kingfisher | |
class ViewController: UIViewController { | |
@IBOutlet weak var imageView: UIImageView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let url = URL(string: "https://i.imgur.com/aMMk5ri.jpg") |
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 synthesizer = AVSpeechSynthesizer() | |
let utterance = AVSpeechUtterance(string: "This is a book") | |
utterance.voice = AVSpeechSynthesisVoice(language: "en-US") | |
synthesizer.speak(utterance) |
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
func makeInt() -> some Equatable { | |
return Int.random(in: 0...10) | |
} | |
func makeString() -> some Equatable { | |
return "HAHA" | |
} |
NewerOlder