Following is my code.. I don't understand why this error shows me everytime.
import UIKit
import Foundation
class BaseLabel:UILabel
{
func setFontAndTitle(FontName:String,FontSize:CGFloat,Title:String) {
self.font = UIFont(name: FontName, size: FontSize)
self.text = Title
}
}
var lbl = BaseLabel()
lbl.setFontAndTitle ("Areal", FontSize: 14, Title: "Check label")
In the last line I am getting the the error "Expression are not allowed at top level"
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…