This is a simple SwiftUI project that uses GraphQL and Apollo to fetch anime data from AniList's GraphQL API. The app allows users to view anime sorted by different criteria and displays the top 3 main characters for each anime along with their images.
- Data Source: Fetches anime data from the AniList GraphQL API using Apollo.
- Sorting Options: Allows users to sort anime by:
- Trending
- Popularity
- Number of Episodes
- Anime Details: Displays each anime's:
- Cover image
- Title (in English or native language)
- Top 3 main characters, including their names and images
![](https://private-user-images.githubusercontent.com/161768744/367468221-d123e6cc-5bff-4c0c-95e7-79c0c0a2b815.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNTE1NzQsIm5iZiI6MTczOTI1MTI3NCwicGF0aCI6Ii8xNjE3Njg3NDQvMzY3NDY4MjIxLWQxMjNlNmNjLTViZmYtNGMwYy05NWU3LTc5YzBjMGEyYjgxNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMVQwNTIxMTRaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yOGUwNjhhYTQzNDMzMmY0YjNkZGE5ZWZmYTYzNmQ4YWVhYTUwYjIyOTAyZDMwZWI1NTBkZWI5NGNlYWNlYzZiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.CQY_O9uQbP9MxLmId1kiGwMH0LuCZGMey0ij_3Tlxc0)
- SwiftUI: For the user interface.
- Apollo: For making GraphQL queries.
- AniList GraphQL API: The source of the anime data.
The app fetches anime data with the following GraphQL query:
query GetActionAnime($page: Int, $perPage: Int, $sort: [MediaSort]) {
Page(page: $page, perPage: $perPage) {
media(genre: "Action", format: TV, sort: $sort) {
title {
native
romaji
english
}
coverImage {
large
}
characters(role: MAIN, perPage: 3) {
edges {
node {
image {
large
}
name {
first
native
}
}
}
}
}
}
}