我有这段代码应该返回两个CGFloat
值的最小值:
var boundsSize:CGSize = scrollView.bounds.size
var imageSize:CGSize = imageView.bounds.size
var xScale:CGFloat = boundsSize.width / imageSize.width
var yScale:CGFloat = boundsSize.height / imageSize.height
var minScale:CGFloat = MIN(xScale, yScale) // this does not work
但MIN
在 swift 中似乎没有等价物。那么我该怎么做呢?