[AltStoreCore] Refactors core AltStore logic into AltStoreCore framework

AltStoreCore will contain all shared AltStore code between AltStore and any app extensions. Initially, it includes all AltStore model logic.
This commit is contained in:
Riley Testut
2020-09-03 16:39:08 -07:00
parent de925e7fea
commit f1a39e1a1f
149 changed files with 3266 additions and 1792 deletions

View File

@@ -0,0 +1,50 @@
//
// Tier.swift
// AltStore
//
// Created by Riley Testut on 8/21/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import Foundation
extension PatreonAPI
{
struct TierResponse: Decodable
{
struct Attributes: Decodable
{
var title: String
}
struct Relationships: Decodable
{
struct Benefits: Decodable
{
var data: [BenefitResponse]
}
var benefits: Benefits
}
var id: String
var attributes: Attributes
var relationships: Relationships
}
}
public struct Tier
{
public var name: String
public var identifier: String
public var benefits: [Benefit] = []
init(response: PatreonAPI.TierResponse)
{
self.name = response.attributes.title
self.identifier = response.id
self.benefits = response.relationships.benefits.data.map(Benefit.init(response:))
}
}