class Manager: NSObject {
static let url: TypeOfUrl = url()
static let shared = Manager(url: url)
let socket: SocketIOClient //var is ok, depends on your need
init(url: TypeOfUrl) {
socket = SocketIOClient(url: url, ...)
super.init()
socket.connect()
}
}
※ 引述《duckscorpion (歆)》之銘言:
: import SocketIO
: class SIOManager:NSObject{
: static let sharedInst = SIOManager()
: var socket = SocketIOClient(socketURL:myURL,config:...)
: override init(){
: super.init()
: socket.connect()
: }
: }
: 想改成init時能指定myURL位置後才連線的方式
: 不曉得該如何調換