kiwix / kiwix-apple

Kiwix for iOS & macOS
https://apple.kiwix.org
GNU Lesser General Public License v3.0
503 stars 69 forks source link
ios kiwix macos offline swift wikipedia

Kiwix for Apple iOS & macOS

This is the home for Kiwix apps for Apple iOS and macOS.

CodeFactor CI Build Status CD Build Status Codecov License: GPL v3

Drawing=

Join Slack

Download

Kiwix apps are made available primarily via the App Store and Mac App Store. macOS version can also be downloaded directly.

Most recent versions of Kiwix support the three latest major versions of the OSes (either iOS or macOS). Older versions of Kiwix being still downloadable for older versions of macOS and iOS on the Mac App Store.

Known bugs

Develop

Kiwix developers usually work with latest macOS and Xcode. Check our Continuous Integration Workflow to find out which Xcode version we use on Github Actions.

Get started

To get started, you will need the following:

Steps

1) clone this repository 2) from the project folder run the following command: brew bundle

Xcode settings

To compile and run Kiwix from Xcode locally, you will need to:

Xcode settings > Text Editing > Editing

"While Editing":

  • ✅ "Automatically trim trailing whitespace"
  • ✅ "Include whitespace-only lines"

Dependencies installed for you

Our Brewfile will install all the necessary dependencies for you:

How XcodeGen is working?

Xcode project files are not directly contained within this repository, instead they are generated for you automatically (as git hooks on post-merge, post-checkout, post-rewrite - see the .pre-commit-config.yaml).

This means, that you can work in Xcode as usual, but you don't need to worry about the project file changes anymore.

Contributors: please note, changes to the Xcode project folder will not be tracked by git.

If you wish to change any settings as part of your contribution, please edit the project.yml file instead.

Please refer to the XcodeGen documentation for further details.

CPU Architectures

Kiwix compiles on both macOS architectures x86_64 and arm64 (Apple silicon).

Kiwix for iOS and macOS can run, in both cases, on x86_64 or arm64.

Switch to another version of the CoreKiwix.xcframework

CoreKiwix.xcframework is published with all supported platforms and CPU architectures:

In order to use another version of CoreKiwix, than the one pre-installed, you can simply replace the CoreKiwix.xcframework folder at the root of the project with the version downloaded, and unpacked.

Compiling CoreKiwix.xcframework

You may want to compile it yourself, to use different branches of said projects for instance.

The xcframework is a bundle of all libkiwix dependencies for multiple architectures and platforms. The CoreKiwix.xcframework will contain libkiwix library for macOS archs and for iOS. It is built off kiwix-build repo.

Make sure to preinstall kiwix-build prerequisites (ninja and meson). If you use homebrew, run the following

brew install ninja meson

Make sure Xcode command tools are installed. Make sure to download an iOS SDK if you want to build for iOS.

xcode-select --install

Then you can build libkiwix

git clone https://github.com/kiwix/kiwix-build.git
cd kiwix-build
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

kiwix-build --config apple_all_static libkiwix
# assuming your kiwix-build and apple folder at at same level
cp -r BUILD_apple_all_static/INSTALL/lib/CoreKiwix.xcframework ../apple/

You can now launch the build from Xcode and use the iOS simulator or your macOS target. At this point the xcframework is not signed.

Debug webviews

In development builds (run from Xcode) it is possible to debug the web-views via Safari development menu.

If Kiwix iOS runs on a device (iPhone or iPad), you need to connect the device to your macOS device via an USB cable.

If Kiwix for macOS or iOS runs in simulator it will work out of the box in this regard.

For a detailed explanation of the web-development mode, please see Apple's documentation: https://developer.apple.com/documentation/safari-developer-tools/inspecting-ios

Deployment

Nightly to FTP

Each night at 01:32 am CET, we build the Kiwix iOS and macOS apps. These are developer signed builds, notarized (a process required to install them outside of the app store) and uploaded to our nightly folder. The files are versioned using the current date.

Weekly to TestFlight

Each Monday at 02:00 am CET, if there were code changes within the last week (any git commits to main), we publish Kiwix for iOS and macOS to Testflight. These are AppStore builds, using the current app version from code (see project.yml).

On-demand TestFlight

It is also possible to trigger Testflight builds - on-demand - by tagging testflight any revision of the code base. You reuse the very same tag for consequent testflight releases. This will run the same process as the "weekly" Testflight (we just do not need to wait up to Monday).

Releasing to AppStore and FTP

Once satisfied with the quality of the app in TestFlight, we can proceed with the Kiwix release process.

The release process is triggered by a GitHub Release. This process creates new testflight builds, and only these should be sent to approval to Apple. The same release process also creates and publishes the macOS DMG to our file server. Once the app is approved by Apple, they can be made available to the public on the App Store.

In case the app is rejected by Apple in a way that requires a new build to fix the issue, a new patch release should be prepared and released... and re-submitted to App Store.

Last step

If all that is done, we should create a PR, incrementing the version number of the project (see: project.yml), and the deployment cycle can start again.

Reporting a bug

License

GPLv3 or later, see LICENSE for more details.