Reorganize AltStore project into UIKit and SwiftUI folders

This commit is contained in:
naturecodevoid
2023-05-20 12:35:53 -07:00
parent e06cca8224
commit 2db073d2c5
115 changed files with 41 additions and 25 deletions

View File

@@ -0,0 +1,47 @@
//
// FilledButtonStyle.swift
// SideStore
//
// Created by Fabian Thies on 29.11.22.
// Copyright © 2022 SideStore. All rights reserved.
//
import SwiftUI
struct FilledButtonStyle: ButtonStyle {
var isLoading: Bool = false
func makeBody(configuration: Configuration) -> some View {
ZStack {
configuration.label
.opacity(isLoading ? 0 : 1)
if isLoading {
ProgressView()
.progressViewStyle(CircularProgressViewStyle())
}
}
.foregroundColor(.white)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
.padding()
.background(
RoundedRectangle(cornerRadius: 12)
.foregroundColor(.accentColor)
)
.opacity(configuration.isPressed || isLoading ? 0.7 : 1)
.disabled(isLoading)
}
}
struct FilledButtonStyle_Previews: PreviewProvider {
static var previews: some View {
SwiftUI.Button {
} label: {
Label("Test Button", systemImage: "testtube.2")
.buttonStyle(FilledButtonStyle())
}
}
}

View File

@@ -0,0 +1,28 @@
//
// PillButtonProgressViewStyle.swift
// SideStore
//
// Created by Fabian Thies on 22.11.22.
// Copyright © 2022 Fabian Thies. All rights reserved.
//
import SwiftUI
struct PillButtonProgressViewStyle: ProgressViewStyle {
let tint: Color
func makeBody(configuration: Configuration) -> some View {
ZStack(alignment: .leading) {
Capsule(style: .continuous)
.foregroundColor(tint.opacity(0.15))
GeometryReader { proxy in
Capsule(style: .continuous)
// .frame(width: proxy.size.width * (configuration.fractionCompleted ?? 0.0))
.foregroundColor(tint)
.offset(x: -proxy.size.width * (1 - (configuration.fractionCompleted ?? 1)))
}
}
.animation(.easeInOut(duration: 0.2))
}
}

View File

@@ -0,0 +1,59 @@
//
// PillButtonStyle.swift
// SideStore
//
// Created by Fabian Thies on 18.11.22.
// Copyright © 2022 Fabian Thies. All rights reserved.
//
import SwiftUI
struct PillButtonStyle: ButtonStyle {
let tintColor: UIColor
var progress: Progress?
func makeBody(configuration: Configuration) -> some View {
ZStack {
if progress == nil {
configuration.label
.opacity(configuration.isPressed ? 0.4 : 1.0)
} else {
ProgressView()
.progressViewStyle(DefaultProgressViewStyle())
}
}
.frame(minWidth: 40)
.padding(.horizontal, 16)
.padding(.vertical, 6)
.background(background)
.foregroundColor(self.progress == nil ? .white : Color(tintColor))
.clipShape(Capsule())
}
var background: some View {
ZStack {
if let progress {
Color(tintColor).opacity(0.15)
ProgressView(progress)
.progressViewStyle(PillButtonProgressViewStyle(tint: Color(tintColor)))
} else {
Color(tintColor)
}
}
}
}
struct PillButtonStyle_Previews: PreviewProvider {
static var previews: some View {
SwiftUI.Button {
} label: {
Text("Label").bold()
}
.buttonStyle(PillButtonStyle(tintColor: Asset.accentColor.color))
}
}