Ich habe den folgenden Code:Objekt Initialisation in Swift
var myBundle:NSBundle
myBundle = NSBundle.mainBundle() // what is the role of this line ??
if let path = myBundle.pathForResource("CellDescriptor", ofType: "plist"){
var cellDescriptors: NSMutableArray!
cellDescriptors = NSMutableArray(contentsOfFile: path)
}
Warum ich diese Zeile Code bin mit myBundle = NSBundle.mainBundle()
? Ich lese, dass es myBundle
Objekt initialisiert. Aber was genau bedeutet das?
Warum kann ich nicht pathForResource
Funktion ohne Initialisierung myBundle
Objekt aufrufen?
Vielen Dank.
Siehe: http://stackoverflow.com/questions/3369136/what-is-nsbundle-and-mainbundle-in-objective-c –