2016-07-23 19 views
1

是否可以在Electron應用程序中調用和調試swift代碼?在macOS上使用電子快速

對於我的特殊情況,我想改變我的屏幕背景。

let sharedWorkspace = NSWorkspace.sharedWorkspace() 
let mainScreen = NSScreen.mainScreen() 
let url = NSURL(string: "path/to/my/image")! 
do { 
    try sharedWorkspace.setDesktopImageURL(url, forScreen: mainScreen!, options: [:]) 
} catch { 
    print (error) 
} 

回答

2

沒有,但你可以把它編譯成二進制和使用child_process.execFile()從電子產卵了。

還有一個節點模塊可以完成你想要實現的功能:wallpaper