Contents

alfianlosari/ITunesFeedGenerator

Provide Swiftly API to fetch top music, apps, books from iTunes Store

Features

  • Pass region code as parameter.
  • Pass result limit (10, 25, 50) as parameter.
  • Pass top free or top paid enum for books or apps feed
  • Swift Async Await Interface

Installation

A detailed guide for installation can be found in Installation Guide.

Swift Package Manager

  • File > Swift Packages > Add Package Dependency
  • Add https://github.com/alfianlosari/ITunesFeedGenerator.git
  • Select "Main" branch

Example

Initialize repository

First of all, you need to initalize the FeedRepository.

let repository = FeedRepository()

Fetch most played songs

// Fetch top 50 most played songs in Indonesia
let songs = try await repository.getMostPlayedSongsFeed(region: "id", resultLimit: .limit50)

Fetch top free or top paid apps

// Fetch top 10 free apps in Great Britain
let topPaidApps = try await repository.getTopAppsFeed(region: "gb", type: .topFree, resultLimit: .limit10)

// Fetch top 25 paid apps in Singapore
let topPaidApps = try await repository.getTopAppsFeed(region: "sg", type: .topPaid, resultLimit: .limit25)

Fetch top free or top paid books

// Fetch top 10 free books in Great Britain
let topPaidApps = try await repository.getTopBooksFeed(region: "gb", type: .topFree, resultLimit: .limit10)

// Fetch top 25 paid books in United States
let topPaidApps = try await repository.getTopBooksFeed(region: "us", type: .topPaid, resultLimit: .limit25)

Supported Region Code Strings

You can get the list of all supported region code parameters from this GitHub Gist. Kudos to Marcus Stöhr/daFish

SwiftUI Helper Library

I also created a library that provide SwiftUI Views to display song/book/app and ObservableObjects to fetch the data using phase state mechanism (loading, success, failure). You can check it out at ITunesFeedSwiftUI

Package Metadata

Repository: alfianlosari/ITunesFeedGenerator

Stars: 9

Forks: 1

Open issues: 0

Default branch: main

Primary language: swift

License: MIT

Topics: itunes, itunes-api, itunes-search, itunes-store, swift

README: README.md