SwiftR — Using R from Swift
0.1 Introduction & Prerequisites
Apple’s Swift programming language3 is used by developers to craft iOS, iPadOS, watchOS, tvOS, and macOS applications and has matured much since Swift 1.0 (at the time of this writing Swift is at version 5.3). More recent versions of Swift have made it much easier to use R’s C interface directly from Swift and the goal of this book is to get you started making command-line apps as well as macOS GUI apps using R’s C interface from Swift.
All the examples were created using Xcode 12.x on macOS Big Sur. Where possible, application targets are set to 10.14 (Mojave)+, but some SwiftUI 2 (the modern way to craft macOS GUI apps) features are only available on macOS 11.x (Big Sur).
For those really new to working in Xcode, Apple has some great starter documentation7 that may be helpful to run through before trying any of the projects/code in the remaining chapters.
0.2 Up Next
With your developer account setup and Xcode ready to roll we’ll build our first macOS command line app with Swift/Xcode.
Code examples can be found on GitHub8, though it may take some time for them to be fully organized and mapped to book chapters.
Writing R Extensions https://cran.r-project.org/doc/manuals/R-exts.html↩︎
How to Create a Free Apple Developer Account https://learnappmaking.com/how-to-create-a-free-apple-developer-account/↩︎