swift class ComposeResultModel NSObject var height CGFloat! var str String = 这种model 并且赋值
You can create and initialize an instance of the ComposeResultModel class with the desired values. Here's an example of how you can do it:
class ComposeResultModel: NSObject {
var height: CGFloat!
var str: String = ""
init(height: CGFloat, str: String) {
self.height = height
self.str = str
}
}
// Usage
let height: CGFloat = 10.0
let str = "Hello, World!"
let resultModel = ComposeResultModel(height: height, str: str)
In this example, resultModel is an instance of ComposeResultModel with the height property set to 10.0 and the str property set to "Hello, World!"
原文地址: https://www.cveoy.top/t/topic/hG9M 著作权归作者所有。请勿转载和采集!