Swiftpack.co - kiliankoe/EmealKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by kiliankoe.
kiliankoe/EmealKit 0.10.1
🎓 Studentenwerk Dresden
⭐️ 5
🕓 1 week ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/kiliankoe/EmealKit.git", from: "0.10.1")

🌯 EmealKit

Swift library for accessing some of the meal related data the Studentenwerk Dresden has to offer.

Quick Start

Current meals or available canteens

let meals = try await Meal.for(canteen: .alteMensa, on: Date())
for meal in meals {

let canteens = try await Canteen.all()
for canteen in canteens {

A completion block based API and one built on Combine are also available.


Talk to the Cardservice to acquire data about your Emeal card. You will need to have registered for Autoload to have the necessary authentication details.

let cardservice = try await Cardservice.login(username: "1234567890", password: "hunter2")
let carddata = try await cardservice.carddata()

let ninetyDaysAgo = Date().addingTimeInterval(-60 * 60 * 24 * 90)
let transactions = try await cardservice.transactions(begin: ninetyDaysAgo)

NFC Scanning

EmealKit also handles scanning the Emeal card via NFC if your device supports it. Just create an Emeal object, conform to EmealDelegate and call beginNFCSession.

class YourEmealHandler: EmealDelegate {
    let emeal: Emeal
    init() {
        let strings = LocalizedEmealStrings(/*...*/)
        emeal = Emeal(localizedStrings: strings)
        emeal.delegate = self
        // Call this to start the NFC session.
    func readData(currentBalance: Double, lastTransaction: Double) {
        // Gets called on a successful scan.
    func invalidate(with error: Error) {
        // Called on errors.

It's even easier if you use ObservableEmeal in your SwiftUI views. It could look something like this.

struct MyView: View {
    @StateObject private var emeal = ObservableEmeal(localizedStrings: .init(/* ... */))
    var body: some View {
        VStack {
            Text("Balance: \(emeal.currentBalance ?? 0.0)")
            Text("Last Transaction: \(emeal.lastTransaction ?? 0.0)")
            if let error = emeal.error {
            Button(action: emeal.beginNFCSession) {
                Text("Scan Emeal")


EmealKit is available through Swift Package Manager.

.package(url: "https://github.com/kiliankoe/EmealKit.git", from: "<#latest#>")

Used by

This library is currently being used in the following applications:

Know of any others? Please open a PR and add it to the list! 😊


Stars: 5
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics