在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:progrium/macdriver开源软件地址:https://github.com/progrium/macdriver开源编程语言:Go 99.5%开源软件介绍:Native Mac APIs for Golang! MacDriver is a toolkit for working with Apple/Mac APIs and frameworks in Go. It currently has 2 parts: 1. Bindings for Objective-CThe cls := objc.NewClass("AppDelegate", "NSObject")
cls.AddMethod("applicationDidFinishLaunching:", func(app objc.Object) {
fmt.Println("Launched!")
})
objc.RegisterClass(cls)
delegate := objc.Get("AppDelegate").Alloc().Init()
app := objc.Get("NSApplication").Get("sharedApplication")
app.Set("delegate:", delegate)
app.Send("run")
2. Framework PackagesThe func main() {
app := cocoa.NSApp_WithDidLaunch(func(notification objc.Object) {
config := webkit.WKWebViewConfiguration_New()
wv := webkit.WKWebView_Init(core.Rect(0, 0, 1440, 900), config)
url := core.URL("http://progrium.com")
req := core.NSURLRequest_Init(url)
wv.LoadRequest(req)
w := cocoa.NSWindow_Init(core.Rect(0, 0, 1440, 900),
cocoa.NSClosableWindowMask|
cocoa.NSTitledWindowMask,
cocoa.NSBackingStoreBuffered, false)
w.SetContentView(wv)
w.MakeKeyAndOrderFront(w)
w.Center()
})
app.SetActivationPolicy(cocoa.NSApplicationActivationPolicyRegular)
app.ActivateIgnoringOtherApps(true)
app.Run()
}
Examplesexamples/largetype - A Contacts/Quicksilver-style Large Type utility in under 80 lines: examples/pomodoro - A menu bar pomodoro timer in under 80 lines: examples/topframe - An always-on-top webview with transparent background in 120 lines [requires Go 1.16+]: NEW: See progrium/topframe for a more fully-featured standalone version! Generating wrappersEventually we can generate most of the wrapper APIs using bridgesupport and/or doc schemas. However, the number of APIs is pretty ridiculous so there are lots of edge cases I wouldn't know how to automate yet. We can just continue to create them by hand as needed until we have enough coverage/confidence to know how we'd generate wrappers. ThanksThe original LicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论