Rc2 Swift Client
This project is a rewrite of the Rc2-client project started at WVU in 2012. There was a lot of legacy cruft from old features that are no longer needed.
The current Mac client requires Docker, and runs the server portion in docker containers. The server portions are developed at rc2server. Eventually this client project will move there, too.
Eventually we'll add back iOS support, once we figure out a hosting solution for the server side stuff.
The wiki contains more details on specific topics.
The macOS client requires 10.13 High Sierra. Development is being done with Xcode 11, swift version 5.1.
The rc2server and mlilback packages are split out so they can also be used by the AppServer, which is also written in Swift.
The following packages/frameworks are used (mostly by SPM, a few require Carthage, some are git submodules in the vendor directory).
Down Markdown parsing/generation
GRDB wrapper around SQlite
iosMath renders equations
Logging Swift API for logging. Allows unified logging across dependencies.
MJLLogger a logging framework that works cross-framework, allows only the application to enable logging, and allows enabling logging per LogCategory. Usable as a Logging implementation.
PEGKit a parsing expression grammar used for syntax highlighting
ReactiveCocoa reactive programming is awesome for handling of async callbacks (like making 14 network calls in a row with a single block of error handling code)
SBInjector very simple dependency injection
SigmaSwiftStatistics swift statistical library
Sparkle enables update notifications, downloading
Starscream for websocket support
SwiftyUserDefaults swifty wrapper around UserDefaults
ZipFoundation for compressing files
Preparing to build
carthage bootstrap --no-use-binaries --platform Mac
git submodule update --init
(cd ..; git clone https://github.com/rc2server/appmodelSwift.git appmodel2). This will eventually be handled by the SPM, but I don't want to have to keep making releases while under active development.
touch config/Local.xcconfig. See below for details on this file.
In the help directory, indexDocs.pl is a perl script to generate a json file with the help information necessary to make an index to search. These files are checked into git. The createHelpIndex target parses these files and creates an sqllite db that is embedded in the application for searching help.
The perl script requires
Generating help files
cd R-3.3.1 ./configure --enable-prebuilt-html make tar zcf rdocs.tgz doc library/*/html/* # cd destination-directory tar xzf rdocs.tgz
The two main config files are
Release.xcconfig. Both include
Shared.xcconfig, which includes
Local.config. The local file is in .gitignore so you need to create an empty one if you don't want warnings about the file being missing.
Therefore the local config file can be used to supply settings that shouldn't be included in git, like API keys and secrets.
An example that uses the official hockeyapp setup and imageInfo URL would be:
INFOPLIST_PREPROCESS = YES INFOPLIST_PREPROCESSOR_DEFINITIONS=SPARKLE_FEED_URL='https://rink.hockeyapp.net/api/2/apps/7574682489924a239272b421546d00f8' LSERVER_UPDATE_URL='http://www.rc2.io/imageInfo.json' OTHER_SWIFT_FLAGS = $(inherited) -DHOCKEYAPP_ENABLED GCC_PREPROCESSOR_DEFINITIONS = $(inherited) HOCKEYAPP_ENABLED=1 HOCKEY_IDENTIFIER='@"7574682489924a239272b421546d00f8"' DEVELOPMENT_TEAM = #Your Team Code#
All apps will link with the HockeyApp SDK, but it is only activated if certain preprocessor macros are set in Local.xcconfig. Here is an example:
OTHER_SWIFT_FLAGS = $(inherited) -DHOCKEYAPP_ENABLED GCC_PREPROCESSOR_DEFINITIONS = $(inherited) HOCKEYAPP_ENABLED=1 HOCKEY_IDENTIFIER='@"7574682489924a239272b421546d00f8"'
Github Flavored Markdown
The repository is a submodule in vendor. Follow these steps to build it (if not already built).
cd vendor/cmark-gfm mkdir build; cd build cmake .. -DCMAKE_INSTALL_PREFIX=./installed make install cp ../src/registry.h installed/cmark-gfm/ cp ../src/plugin.h installed/cmark-gfm/ cp ../src/syntax_extension.h /installed/cmark-gfm/ rm build/installed/lib/*.dylib
The additional header files are necessary to call some functions defined in cmark-gfm.h
The build directory is in .gitignore, so there should never be any issues with git and unkown files.
ld on macOS will link to dylibs if they are in the same directory as static libraries, even if they aren't in the project settings. So they need to be removed.
--resetSupportDataforces removal of Caches and ApplicationSupport directories and all contents
DisableHockeyAppdisables HockeyApp loading
XCTestConfigurationFilePathis set by Xcode when running unit tests. If set, skips startup actions.
Logging is done via MJLLogger using a configuration class of Rc2LogConfig. Allows setting log level per LogCategory (e.g. enable debug logging for networking only). The swift-log Logging framework is bootstraped with MJLLogger, so any dependencies using swift-log will be logged along with everything else.