vendredi 9 janvier 2015

Do Swift screensavers work in Mac OS X before Yosemite?


I rewrote the screen saver template that Xcode generates from Objective-C into Swift and when I try to load it I get this message:



You cannot use the BlahBlah screensaver with this version of MacOSX.

Please contact the vendor to get a new version of the screen saver.


I'm currently running Mavericks. Does it mean that Swift screen savers only work in Yosemite, or not even there?


This is the Swift code I used to replace the Objetive-C one:



import Foundation
import ScreenSaver

class BlahBlahView : ScreenSaverView {
convenience override init() {
self.init(frame: CGRectZero, isPreview: false)
}

override init(frame: NSRect, isPreview: Bool) {
super.init(frame: frame, isPreview: isPreview)

setAnimationTimeInterval(1.0 / 30.0)
}

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}


override func startAnimation() {
super.startAnimation()
}

override func stopAnimation() {
super.stopAnimation()
}

override func drawRect(rect: NSRect) {
super.drawRect(rect)
}

override func animateOneFrame() {

}

override func hasConfigureSheet() -> Bool {
return false
}

override func configureSheet() -> NSWindow? {
return nil
}
}


These are my project settings:


enter image description here


This was originally an Objective-C project (there's no Swift Screensaver template) created on MacOSX 10.9 and the APIs I'm using, Screensaver, have existed for years.





Aucun commentaire:

Enregistrer un commentaire