Go Mobile UI Bindings

agolangf · · 864 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>I&#39;ve been using React Native for a small mobile project and it got me thinking about possibly piggy backing off it to produce a native user interface in Go. </p> <p>The way React Native works is that they execute JavaScript in a background thread which runs your application logic, and the framework produces native user interface via bindings from JavaScript to native code. </p> <p>I&#39;ve been wondering if we could replace the JavaScript layer with Go, making it possible to build all your application logic and user interface logic in Go. </p> <p>Before I started hacking too much I thought I&#39;d elicit opinions from the community.</p> <p>Thanks. PM me if you might be interested in doing the project with me.</p> <hr/>**评论:**<br/><br/>caseynashvegas: <pre><p>I don&#39;t really think GopherJS is what I am going for, more of a pure Go implementation, getting the Go syntax vs. JavaScript isn&#39;t the goal, the goal is replace the layer with go. </p></pre>dasacc22: <pre><p>this has been on my mind for a while, not really specific to Go, just in general. The react native demo was impressive whether you like javascript or not so it&#39;s certainly gotten some people thinking, for example <a href="https://github.com/pfn/protify" rel="nofollow">https://github.com/pfn/protify</a></p></pre>caseynashvegas: <pre><p>I&#39;ve been using it and have been extremely impressed. React is a game changer for the user interface in many ways. Emitting declarive, immutable state for the user interface instead of dealing with it though an imperative API is the true genius of the platform.</p></pre>santagada: <pre><p>The problem is that I don&#39;t think there is c api to call go code from c right? And also no shared library or dynamic loading in arm either so it seems to be a lot of work.</p></pre>caseynashvegas: <pre><p>My thought is that we could use gobind to expose a simple interface between the native Obj-C or Java application code and the app library written in Go. <a href="https://godoc.org/golang.org/x/mobile/cmd/gobind">https://godoc.org/golang.org/x/mobile/cmd/gobind</a></p> <p>The reason I was thinking about piggy backing off the work that they&#39;ve done in React Native is that they&#39;ve essentially created a protocol for building native user interfaces from javascript by marshaling JSON messages to and from their JavaScript runtime. Since the gobind tool can pass those back and forth it shouldn&#39;t be a problem to do the same. </p></pre>santagada: <pre><p>Cool!</p></pre>ngrilly: <pre><p>Maybe with by compiling Go to JS with GopherJS: <a href="https://github.com/gopherjs/gopherjs" rel="nofollow">https://github.com/gopherjs/gopherjs</a></p></pre>ngrilly: <pre><p>Another interesting link about using GopherJS with React: <a href="https://news.ycombinator.com/item?id=9286750" rel="nofollow">https://news.ycombinator.com/item?id=9286750</a></p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

864 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传