Skip to content

antigluten/ios-anki

Repository files navigation

Anki iOS

An open-source, offline-first iOS Anki client with full AnkiWeb sync.

Swift 6.2 iOS 17+ Rust FFI AGPL-3.0


Anki iOS wraps the official ankitects/anki Rust backend via C FFI, giving you a native SwiftUI experience backed by the same battle-tested engine that powers Anki Desktop and AnkiDroid. Sync your decks with AnkiWeb, study with FSRS scheduling, and keep your review history in perfect sync across all your devices.

Features

  • Full AnkiWeb Sync -- login, sync, full upload/download, bidirectional review sync
  • FSRS Scheduling -- powered by the official Rust FSRS engine, not a reimplementation
  • Card Rendering -- Rust template engine renders cards exactly like desktop Anki
  • Deck Browser -- hierarchical deck tree with recursive DisclosureGroup expand/collapse, new/learn/review count badges on every node
  • Study Session -- answer cards with Again/Hard/Good/Easy; next-interval labels shown above each button
  • Note Browser -- search notes across all decks, deck filter chips (top-level decks auto-include subdecks), lazy-load results (50 per page)
  • Note Editor -- edit note fields with accurate field names from the Rust notetype RPC
  • Statistics Dashboard -- full-year review heatmap (auto-scrolls to today), streak counter, retention rate, forecast chart, card count breakdown
  • Offline-First -- everything works offline; sync when you have a connection
  • Swift 6.2 Strict Concurrency -- zero data races, fully actor-isolated, Sendable throughout

Screenshots

Decks Screen Stats Screen

Architecture

SwiftUI Views
    |
@DependencyClient structs
    |
AnkiBackend (Swift wrapper)
    |
C FFI (4 functions)
    |
Rust static library (ankitects/anki)

Swift owns the UI. Rust owns everything else -- database, sync, FSRS scheduling, card templates, statistics.

For the full architecture walkthrough, see ARCHITECTURE.md.

Requirements

Tool Version
iOS 17.0+
Xcode 16.0+
Rust 1.92+ (via rustup)
protoc 3.0+
protoc-gen-swift latest
xcodegen latest

Getting Started

1. Clone with submodules

git clone --recursive https://github.com/antigluten/anki-ios.git
cd anki-ios

2. Install dependencies

# Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-ios-simulator

# Protobuf compiler and Swift plugin
brew install protobuf swift-protobuf

# Xcode project generator
brew install xcodegen

3. Build the Rust XCFramework

./scripts/build-xcframework.sh

This cross-compiles the Rust bridge for iOS device and simulator, then packages both into AnkiRust.xcframework. The first build takes several minutes; incremental builds are fast.

4. Generate Swift protobuf types

./scripts/generate-protos.sh

5. Open in Xcode

cd AnkiApp && xcodegen generate && cd ..
open AnkiApp/AnkiApp.xcodeproj

6. Build and Run

Select an iOS Simulator or device, then build and run (Cmd+R).

Tech Stack

  • UI: SwiftUI with strict concurrency (Swift 6.2, language mode v6)
  • Dependency Injection: swift-dependencies (@DependencyClient struct-closure pattern)
  • Backend: ankitects/anki Rust crate via C FFI
  • Serialization: Protocol Buffers (24 .proto service definitions)
  • Database: SQLite (owned by Rust backend)
  • Build: SPM for library modules, xcodegen for the app target

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) because it incorporates ankitects/anki (copyright Ankitects Pty Ltd), which is also AGPL-3.0. See LICENSE for the full license text.

The AGPL requires that if you distribute this software or run it as a network service, you must make the complete source code available under the same license.

Contributing

Contributions are welcome. See CONTRIBUTING.md for guidelines, code style, and the development setup.

Acknowledgments

About

A native, open-source iOS client for Anki flashcards. Offline-first with full AnkiWeb sync, powered by the official Anki Rust backend via C FFI.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages