mastodon-ios/Documentation/Setup.md

3.2 KiB

Setup

Requirements

  • Xcode 14+
  • Swift 5.7+
  • iOS 14.0+

Install the latest version of Xcode from the App Store or Apple Developer Download website. Also, we assert you have the Homebrew package manager.

This guide may not suit your machine and actually setup procedure may change in the future. Please file the issue or Pull Request if there are any problems.

CocoaPods

The app use CocoaPods and Arkana. Ruby Gems are managed through Bundler. Make sure you have Rosetta installed if you are using the M1 Mac.

# install the rbenv
brew install rbenv

# configure the terminal
which ruby
# > /usr/bin/ruby
echo 'eval "$(rbenv init -)"' >> ~/.zprofile
source ~/.zprofile
which ruby
# > /Users/mainasuk/.rbenv/shims/ruby

# restart the terminal

# install ruby (we use the version defined in .ruby-version)
rbenv install

# install gem dependencies
bundle install

Bootstrap

# make a clean build
bundle install
bundle exec pod clean

# setup arkana
# please check the `.env.example` to create your's or use the empty example directly
bundle exec arkana -e ./env/.env

# clean pods
bundle exec pod clean

# make install
bundle exec pod install --repo-update

# open workspace
open Mastodon.xcworkspace

The Arkana plugin will setup the push notification endpoint. You can use the empty template from ./env/.env or use your own .env file. To setup the push notification. Please check section Push Notification below.

The app requires the App Group capability. To make sure it works for your developer membership. Please check AppSecret.swift file and set another unique groupID and update App Group settings.

Push Notification (Optional)

The app is compatible with toot-relay APNs. You can set your push notification endpoint via Arkana. There are two endpoints:

  • NotificationEndpointDebug: for DEBUG usage. e.g. https://<your.domin>/relay-to/development
  • NotificationEndpointRelease: for RELEASE usage. e.g. https://<your.domin>/relay-to/production

Please check the Establishing a Certificate-Based Connection to APNs document to generate the certificate and exports the p12 file.

Note: Please check and set the notification.Topic to the app BundleID in toot-relay.go. The server needs use a reverse proxy to port this relay on 443 port with valid domain and HTTPS certificate.

Start

  1. Open Mastodon.xcworkspace
  2. Wait for the Swift Package Dependencies resolved.
  3. Check the signing settings make sure to choose a team. More info…
  4. Select Mastodon scheme and device then run it. (Command + R)

What's next

We welcome contributions! And if you have an interest to contribute codes. Here is a document that describes the app architecture and what's tech stack it uses.