什么是最好的和优化使用Swift 3.0中的struct

时间:2017-06-23 16:03:43

标签: swift struct swift3

EDITED

我必须创建一个带有多个输入参数的结构。以下是我的结构当前结构。

struct TTFBCard {

public var id:String
public var userId:String
public var imgUrl:String
public var audioData:String
public var displayText:TTLocaleString
public var messageText:TTLocaleString
public var resStartTime:String
public var resEndTime:String
public var subCards:NSArray
public var type:String
private var _rawTime:TimeInterval?
private var _order:Int?

init(id:String,userId:String,imgUrl:String,audioData:String,displayText:TTLocaleString,messageText:TTLocaleString,resStartTime:String,resEndTime:String,subCards:NSArray,type:String) {
    self.id = id
    self.userId = userId
    self.imgUrl = imgUrl
    self.audioData = audioData
    self.displayText = displayText
    self.messageText = messageText
    self.resStartTime = resStartTime
    self.resEndTime = resEndTime
    self.subCards = subCards
    self.type = type
}

}

发送太多参数真的很糟糕。请提出任何建议!

0 个答案:

没有答案