Nate
Nate

Reputation: 188

Finding .icns files swift

This is my code. All the lines execute but only the last line works because thats the last line that has to get executed. Does any one know how I can maybe put all this code into one line or make all of the lines actually execute. Thanks

override func controlTextDidChange(notification: NSNotification) {

    let url = NSURL(fileURLWithPath: "/Applications/\(Search.stringValue).app/Contents/Resources/AppIcon.icns")
    Theimageicon.image = NSImage(byReferencingURL: url)

    let url2 = NSURL(fileURLWithPath: "/Applications/\(Search.stringValue).app/Contents/Resources/icon.icns")
    Theimageicon.image = NSImage(byReferencingURL: url2)

    let url3 = NSURL(fileURLWithPath: "/Applications/\(Search.stringValue).app/Contents/Resources/\(Search.stringValue).icns")
    Theimageicon.image = NSImage(byReferencingURL: url3)

}

Upvotes: 2

Views: 321

Answers (1)

FredericP
FredericP

Reputation: 1119

I think all lines execute, but you change the value of theImageIcon.image three times, so you can see at the end the third one.

Upvotes: 2

Related Questions