Saturday, April 10, 2021

New SwiftR Chapter Up: Building an R-backed SwiftUI macOS App

Final week I launched a brand new bookdown collection on embed R right into a macOS Swift utility.

The preliminary chapters targeted on core ideas and confirmed construct a macOS compiled, binary command line utility that makes use of embedded R for some performance.

This week, a brand new chapter is up that walks you although construct a primary SwiftUI utility that takes enter from the consumer, performs a computation in R (through embedded R) and shows the results of the computation again to the consumer.

The app seems to be like this:

and — aside from among the boilerplate interface code from earlier chapters — is round ~60 traces of Swift code that finally ends up consuming ~65 MB of lively RAM when run with nearly no power influence (an equal Electron-packaged Shiny app can be 130-200 MB of preliminary RAM and have a major, fixed power influence).

There’s ample boilerplate on this venture to increase to jot down a primary GUI wrapper for numerous R operations you will have hanging round.

Forthcoming chapters will present get graphics out of R and right into a SwiftUI window in addition to make a extra diminutive Shiny app wrapper that we’ll ultimately be capable to ship with an embedded copy of the R framework.

*** It is a Safety Bloggers Community syndicated weblog from rud.is authored by hrbrmstr. Learn the unique submit at: https://rud.is/b/2021/01/16/new-swiftr-chapter-up-building-an-r-backed-swiftui-macos-app/

Latest news

Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here