Swiftpack.co -  JRomainG/MangaDexLib as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
JRomainG/MangaDexLib
A cross-platform Swift framework to interact with the MangaDex website
.package(url: "https://github.com/JRomainG/MangaDexLib.git", from: "v0.5-beta")

MangaDexLib

MangaDexLib is a cross-platform Swift framework to interact with the MangaDex website. Its goal is to offer a robust abstract interface to access the API's core features.

Note: The official MangaDex API is currently in a read-only state and some features might not be available yet.

Installing

MangaDexLib requires Swift 5 or newer.

CocoaPods

MangaDexLib is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'MangaDexLib'

Carthage

MangaDexLib is available Carthage. To install it, simply add the following line to your Cartfile:

github "JRomainG/MangaDexLib"

Swift Package Manager

MangaDexLib is available through Swift Package Manager. To install it, simply add the dependency to your Package.Swift file:

...
dependencies: [
    .package(url: "https://github.com/JRomainG/MangaDexLib.git", .branch("master")),
],
targets: [
    .target(name: "YourTarget", dependencies: ["MangaDexLib"]),
]
...

Sources

If you do not wish to use a package manager, you can also simply copy the Sources directory to your project.

Example usage

Here are a few examples of how to use the API:

To get a list of mangas:

import MangaDexLib
let api = MDApi()
api.getMangaList { (res, error) in
    print(res?.results)
}

To get a manga's chapters:

let mangaId = "32d76d19-8a05-4db0-9fc2-e0b0648fe9d0" // Solo leveling
api.getMangaFeed(mangaId: mangaId) { (res, error) in
    print(res?.results)
}

To get a chapter's pages:

let chapterId = "eaaac5cc-07aa-412b-be50-9f342ceedffb" // Eight volume 4 chapter 37.6 (en)
api.viewChapter(chapterId: chapterId) { (res, error) in
    let chapter = res?.object?.data
    api.getChapterServer(chapterId: chapterId) { (node, error) in
        print(chapter?.getPageUrls(node: node!, lowRes: false))
    }
}

To login to a user's account:

let credentials = MDAuthCredentials(username: "username", password: "password")
api.login(credentials: credentials) { (error) in
    print(api.sessionJwt)
}

You should also check out Kitsune, an open-source reader for macOS built using MangaDexLib!

Documentation

The project is extensively documented through comments, and Jazzy is used to generate documentation. It is available from this url, and updated each time a new version is released.

You can also access the official documentation for the MangaDex API here.

Development

To install, simply checkout the dev branch of this repository:

git clone https://github.com/JRomainG/MangaDexLib.git
git checkout dev

You will then be able to open the MangaDexLib.xcodeproj project.

This project uses SwiftLint to enforce Swift style and conventions. It also implements unit tests using XCTest, which try to cover as many features as possible.

Contributing

If you found a bug, or would like to see a new feature added, feel free to open an issue on the Github page. Pull requests are welcome!

If you can, also consider supporting MangaDex and the team behind the website.

License

The project is available under the GPLv3 license.

Disclaimer

This project is not related to the MangaDex team, and is independently developed.

GitHub

link
Stars: 1
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

4 weeks ago

First beta release for version 5 of the MangaDex API. All features in the official documentation should be implemented.

This version introduces many breaking changes and can be seen as a complete rewrite for the new MangaDex API. The SwiftSoup dependency has been dropped as there is no need to parse HTML pages anymore. Overall, this should make MangaDexLib faster and more reliable.

Note: The official MangaDex API is still in beta and in a read-only state, so some features might not be available yet.

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