mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 19:53:25 +01:00
[Widgets]: cleanup: refactored to use guard-else flow instead of if-else flow
This commit is contained in:
@@ -18,13 +18,12 @@ public enum Direction: String, Sendable{
|
|||||||
public struct NavigationEvent {
|
public struct NavigationEvent {
|
||||||
let direction: Direction?
|
let direction: Direction?
|
||||||
var consumed: Bool = false
|
var consumed: Bool = false
|
||||||
|
var dataHolder: PaginationDataHolder?
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(iOS 17, *)
|
@available(iOS 17, *)
|
||||||
class PaginationIntent: AppIntent, @unchecked Sendable {
|
class PaginationIntent: AppIntent, @unchecked Sendable {
|
||||||
|
|
||||||
private let COMMON_WIDGET_ID = 1
|
|
||||||
|
|
||||||
static var title: LocalizedStringResource = "Page Navigation Intent"
|
static var title: LocalizedStringResource = "Page Navigation Intent"
|
||||||
static var isDiscoverable: Bool = false
|
static var isDiscoverable: Bool = false
|
||||||
|
|
||||||
@@ -45,17 +44,28 @@ class PaginationIntent: AppIntent, @unchecked Sendable {
|
|||||||
// if id was not passed in, then we assume the widget isn't customized yet
|
// if id was not passed in, then we assume the widget isn't customized yet
|
||||||
// hence we use the common ID, if this is not present in registry of PageInfoManager
|
// hence we use the common ID, if this is not present in registry of PageInfoManager
|
||||||
// then it will return nil, triggering to show first page in the provider
|
// then it will return nil, triggering to show first page in the provider
|
||||||
self.widgetID = widgetID ?? COMMON_WIDGET_ID
|
self.widgetID = widgetID ?? WidgetUpdateIntent.COMMON_WIDGET_ID
|
||||||
self.direction = direction.rawValue
|
self.direction = direction.rawValue
|
||||||
self.widgetKind = widgetKind
|
self.widgetKind = widgetKind
|
||||||
}
|
}
|
||||||
|
|
||||||
func perform() async throws -> some IntentResult {
|
func perform() async throws -> some IntentResult {
|
||||||
|
// Post the navigation event into the shared db (Dictionary) and ask to reload
|
||||||
DispatchQueue(label: String(widgetID)).sync {
|
DispatchQueue(label: String(widgetID)).sync {
|
||||||
let navigationEvent = NavigationEvent(direction: Direction(rawValue: direction))
|
self.postThisNavigationEvent()
|
||||||
PageInfoManager.shared.setPageInfo(for: widgetID, value: navigationEvent)
|
|
||||||
WidgetCenter.shared.reloadTimelines(ofKind: widgetKind)
|
WidgetCenter.shared.reloadTimelines(ofKind: widgetKind)
|
||||||
}
|
}
|
||||||
return .result()
|
return .result()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func postThisNavigationEvent(){
|
||||||
|
// re-use an existing event if available and update only required parts
|
||||||
|
let navEvent = PageInfoManager.shared.getPageInfo(forWidgetKind: widgetKind, forWidgetID: widgetID)
|
||||||
|
let navigationEvent = NavigationEvent(
|
||||||
|
direction: Direction(rawValue: direction),
|
||||||
|
consumed: false, // event is never consumed at origin :D
|
||||||
|
dataHolder: navEvent?.dataHolder ?? nil
|
||||||
|
)
|
||||||
|
PageInfoManager.shared.setPageInfo(forWidgetKind: widgetKind, forWidgetID: widgetID, value: navigationEvent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import AppIntents
|
|||||||
|
|
||||||
@available(iOS 17, *)
|
@available(iOS 17, *)
|
||||||
final class WidgetUpdateIntent: WidgetConfigurationIntent, @unchecked Sendable {
|
final class WidgetUpdateIntent: WidgetConfigurationIntent, @unchecked Sendable {
|
||||||
|
public static let COMMON_WIDGET_ID = 1
|
||||||
|
|
||||||
static var title: LocalizedStringResource { "Widget ID update Intent" }
|
static var title: LocalizedStringResource { "Widget ID update Intent" }
|
||||||
static var isDiscoverable: Bool { false }
|
static var isDiscoverable: Bool { false }
|
||||||
|
|||||||
@@ -6,22 +6,32 @@
|
|||||||
// Copyright © 2025 SideStore. All rights reserved.
|
// Copyright © 2025 SideStore. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
// This is a utility class
|
import Foundation
|
||||||
|
|
||||||
|
// TODO: See if we can persist these values instead of keeping in memory to prevent memory leaks
|
||||||
|
// Possible ways: Userdefaults.standard - set/get ?
|
||||||
class PageInfoManager {
|
class PageInfoManager {
|
||||||
static var shared = PageInfoManager()
|
static var shared = PageInfoManager()
|
||||||
private var pageInfoMap: [Int: NavigationEvent] = [:]
|
private var pageInfoMap: [String: NavigationEvent] = [:]
|
||||||
|
|
||||||
private init() {}
|
private init() {}
|
||||||
|
|
||||||
func setPageInfo(for key: Int, value: NavigationEvent?) {
|
private func getKey(forWidgetKind kind: String, forWidgetID id: Int) -> String{
|
||||||
|
return "\(kind)@\(id)"
|
||||||
|
}
|
||||||
|
|
||||||
|
func setPageInfo(forWidgetKind kind: String, forWidgetID id: Int, value: NavigationEvent?) {
|
||||||
|
let key = getKey(forWidgetKind: kind, forWidgetID: id)
|
||||||
pageInfoMap[key] = value
|
pageInfoMap[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
func getPageInfo(for key: Int) -> NavigationEvent? {
|
func getPageInfo(forWidgetKind kind: String, forWidgetID id: Int) -> NavigationEvent? {
|
||||||
return pageInfoMap[key]
|
let key = getKey(forWidgetKind: kind, forWidgetID: id)
|
||||||
|
return pageInfoMap[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
func popPageInfo(for key: Int) -> NavigationEvent? {
|
func popPageInfo(forWidgetKind kind: String, forWidgetID id: Int) -> NavigationEvent? {
|
||||||
|
let key = getKey(forWidgetKind: kind, forWidgetID: id)
|
||||||
return pageInfoMap.removeValue(forKey: key)
|
return pageInfoMap.removeValue(forKey: key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,10 +18,16 @@ class ActiveAppsTimelineProvider<T: WidgetInfo>: AppsTimelineProviderBase<Widge
|
|||||||
let ID: Int?
|
let ID: Int?
|
||||||
}
|
}
|
||||||
|
|
||||||
private let dataHolder = PaginationDataHolder(
|
private let defaultDataHolder = PaginationDataHolder(
|
||||||
itemsPerPage: ActiveAppsWidget.Constants.MAX_ROWS_PER_PAGE
|
itemsPerPage: ActiveAppsWidget.Constants.MAX_ROWS_PER_PAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
let widgetKind: String
|
||||||
|
|
||||||
|
init(widgetKind: String){
|
||||||
|
self.widgetKind = widgetKind
|
||||||
|
}
|
||||||
|
|
||||||
deinit{
|
deinit{
|
||||||
// if this provider goes out of scope, clear all entries
|
// if this provider goes out of scope, clear all entries
|
||||||
PageInfoManager.shared.clearAll()
|
PageInfoManager.shared.clearAll()
|
||||||
@@ -30,36 +36,65 @@ class ActiveAppsTimelineProvider<T: WidgetInfo>: AppsTimelineProviderBase<Widge
|
|||||||
override func getUpdatedData(_ apps: [AppSnapshot], _ context: WidgetInfo?) -> [AppSnapshot] {
|
override func getUpdatedData(_ apps: [AppSnapshot], _ context: WidgetInfo?) -> [AppSnapshot] {
|
||||||
var apps = apps
|
var apps = apps
|
||||||
|
|
||||||
|
// if simulator, get the 10 simulated entries based on first entry
|
||||||
#if targetEnvironment(simulator)
|
#if targetEnvironment(simulator)
|
||||||
apps = getSimulatedData(apps: apps)
|
apps = getSimulatedData(apps: apps)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var currentPageApps = dataHolder.currentPage(inItems: apps)
|
// always first page since this is never updated
|
||||||
if let widgetInfo = context,
|
var currentPageApps = defaultDataHolder.currentPage(inItems: apps)
|
||||||
let widgetID = widgetInfo.ID {
|
|
||||||
|
guard let widgetInfo = context,
|
||||||
var navEvent: NavigationEvent? = PageInfoManager.shared.getPageInfo(for: widgetID)
|
let widgetID = widgetInfo.ID else
|
||||||
if let event = navEvent,
|
{
|
||||||
let direction = event.direction
|
return currentPageApps
|
||||||
{
|
|
||||||
// process navigation request only if event wasn't consumed yet
|
|
||||||
if !event.consumed {
|
|
||||||
switch (direction){
|
|
||||||
case Direction.up:
|
|
||||||
currentPageApps = dataHolder.prevPage(inItems: apps, whenUnavailable: .current)!
|
|
||||||
case Direction.down:
|
|
||||||
currentPageApps = dataHolder.nextPage(inItems: apps, whenUnavailable: .current)!
|
|
||||||
}
|
|
||||||
// mark the event as consumed
|
|
||||||
// this prevents duplicate getUpdatedData() requests for same navigation event
|
|
||||||
navEvent!.consumed = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PageInfoManager.shared.setPageInfo(for: widgetID, value: navEvent)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let navEvent = getPageInfo(widgetID: widgetID)
|
||||||
|
guard var navEvent = navEvent,
|
||||||
|
let direction = navEvent.direction else
|
||||||
|
{
|
||||||
|
// when widget is edited for new ID than the current,
|
||||||
|
// buttons were never triggered for this ID,
|
||||||
|
// hence nav-event or direction wasn't set yet
|
||||||
|
updatePageInfo(
|
||||||
|
widgetID: widgetID,
|
||||||
|
navEvent: NavigationEvent(direction: nil, consumed: true, dataHolder: PaginationDataHolder(other: defaultDataHolder))
|
||||||
|
)
|
||||||
|
return currentPageApps
|
||||||
|
}
|
||||||
|
|
||||||
|
let dataHolder = navEvent.dataHolder!
|
||||||
|
|
||||||
|
// process navigation request only if event wasn't consumed yet
|
||||||
|
if !navEvent.consumed {
|
||||||
|
switch (direction){
|
||||||
|
case Direction.up:
|
||||||
|
currentPageApps = dataHolder.prevPage(inItems: apps, whenUnavailable: .current)!
|
||||||
|
case Direction.down:
|
||||||
|
currentPageApps = dataHolder.nextPage(inItems: apps, whenUnavailable: .current)!
|
||||||
|
}
|
||||||
|
// mark the event as consumed
|
||||||
|
// this prevents duplicate getUpdatedData() requests for same navigation event
|
||||||
|
navEvent.consumed = true
|
||||||
|
}else{
|
||||||
|
// since the event was consumed, get the current page as-is for this dataholder
|
||||||
|
currentPageApps = dataHolder.currentPage(inItems: apps)
|
||||||
|
}
|
||||||
|
|
||||||
|
// put back the data
|
||||||
|
updatePageInfo(widgetID: widgetID, navEvent: navEvent)
|
||||||
return currentPageApps
|
return currentPageApps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private func getPageInfo(widgetID: Int) -> NavigationEvent?{
|
||||||
|
return PageInfoManager.shared.getPageInfo(forWidgetKind: widgetKind, forWidgetID: widgetID)
|
||||||
|
}
|
||||||
|
|
||||||
|
private func updatePageInfo(widgetID: Int, navEvent: NavigationEvent?) {
|
||||||
|
PageInfoManager.shared.setPageInfo(forWidgetKind: widgetKind, forWidgetID: widgetID, value: navEvent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TimelineProvider for WidgetAppIntentConfiguration widget type
|
/// TimelineProvider for WidgetAppIntentConfiguration widget type
|
||||||
|
|||||||
@@ -32,16 +32,23 @@ struct ActiveAppsWidget: Widget
|
|||||||
static let MAX_ROWS_PER_PAGE: UInt = 3
|
static let MAX_ROWS_PER_PAGE: UInt = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
let widgetKind = "ActiveApps - \(UUID().uuidString)"
|
private static var id: Int = 1
|
||||||
|
private let widgetKind: String
|
||||||
|
|
||||||
|
init(){
|
||||||
|
widgetKind = "ActiveApps - \(Self.id)"
|
||||||
|
Self.id += 1
|
||||||
|
}
|
||||||
|
|
||||||
public var body: some WidgetConfiguration {
|
public var body: some WidgetConfiguration {
|
||||||
|
|
||||||
if #available(iOS 17, *)
|
if #available(iOS 17, *)
|
||||||
{
|
{
|
||||||
|
|
||||||
let widgetConfig = AppIntentConfiguration(
|
let widgetConfig = AppIntentConfiguration(
|
||||||
kind: widgetKind,
|
kind: widgetKind,
|
||||||
intent: WidgetUpdateIntent.self,
|
intent: WidgetUpdateIntent.self,
|
||||||
provider: ActiveAppsTimelineProvider<WidgetTag>()
|
provider: ActiveAppsTimelineProvider<WidgetTag>(widgetKind: widgetKind)
|
||||||
) { entry in
|
) { entry in
|
||||||
ActiveAppsWidgetView(entry: entry, widgetKind: widgetKind)
|
ActiveAppsWidgetView(entry: entry, widgetKind: widgetKind)
|
||||||
}
|
}
|
||||||
@@ -97,129 +104,106 @@ private struct ActiveAppsWidgetView: View
|
|||||||
GeometryReader { (geometry) in
|
GeometryReader { (geometry) in
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
|
|
||||||
appsListView(reader: geometry)
|
let itemsPerPage = ActiveAppsWidget.Constants.MAX_ROWS_PER_PAGE
|
||||||
|
|
||||||
|
let preferredRowHeight = (geometry.size.height / Double(itemsPerPage)) - 8
|
||||||
|
let rowHeight = min(preferredRowHeight, geometry.size.height / 2)
|
||||||
|
|
||||||
|
LazyVStack(spacing: 12) {
|
||||||
|
ForEach(Array(entry.apps.enumerated()), id: \.offset) { index, app in
|
||||||
|
|
||||||
|
let icon: UIImage = app.icon ?? UIImage(named: "SideStore")!
|
||||||
|
|
||||||
|
// 1024x1024 images are not supported by previews but supported by device
|
||||||
|
// so we scale the image to 97% so as to reduce its actual size but not too much
|
||||||
|
// to somewhere below value, acceptable by previews ie < 1042x948
|
||||||
|
let scalingFactor = 0.97
|
||||||
|
|
||||||
|
let resizedSize = CGSize(
|
||||||
|
width: icon.size.width * scalingFactor,
|
||||||
|
height: icon.size.height * scalingFactor
|
||||||
|
)
|
||||||
|
|
||||||
|
let resizedIcon = icon.resizing(to: resizedSize)!
|
||||||
|
let cornerRadius = rowHeight / 5.0
|
||||||
|
let daysRemaining = app.expirationDate.numberOfCalendarDays(since: entry.date)
|
||||||
|
|
||||||
|
HStack(spacing: 10) {
|
||||||
|
Image(uiImage: resizedIcon)
|
||||||
|
.resizable()
|
||||||
|
.aspectRatio(contentMode: .fit)
|
||||||
|
.cornerRadius(cornerRadius)
|
||||||
|
|
||||||
|
|
||||||
|
VStack(alignment: .leading, spacing: 1) {
|
||||||
|
Text(app.name)
|
||||||
|
.font(.system(size: 15, weight: .semibold, design: .rounded))
|
||||||
|
|
||||||
|
let text = if entry.date > app.expirationDate
|
||||||
|
{
|
||||||
|
Text("Expired")
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Text("Expires in \(daysRemaining) ") + (daysRemaining == 1 ? Text("day") : Text("days"))
|
||||||
|
}
|
||||||
|
|
||||||
|
text
|
||||||
|
.font(.system(size: 13, weight: .semibold, design: .rounded))
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Countdown(startDate: app.refreshedDate,
|
||||||
|
endDate: app.expirationDate,
|
||||||
|
currentDate: entry.date,
|
||||||
|
strokeWidth: 3.0) // Slightly thinner circle stroke width
|
||||||
|
.background {
|
||||||
|
Color.black.opacity(0.1)
|
||||||
|
.mask(Capsule())
|
||||||
|
.padding(.all, -5)
|
||||||
|
}
|
||||||
|
.font(.system(size: 16, weight: .semibold, design: .rounded))
|
||||||
|
// this modifier invalidates the view (disables user interaction and shows a blinking effect)
|
||||||
|
.invalidatableContent()
|
||||||
|
.activatesRefreshAllAppsIntent()
|
||||||
|
|
||||||
|
}
|
||||||
|
.frame(height: rowHeight)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Spacer(minLength: 16)
|
Spacer(minLength: 16)
|
||||||
|
|
||||||
navigationBarView()
|
let buttonWidth: CGFloat = 16
|
||||||
|
let widgetID = entry.context?.ID
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
Image(systemName: "arrow.up")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: buttonWidth, height: buttonWidth)
|
||||||
|
.opacity(0.3)
|
||||||
|
// .mask(Capsule())
|
||||||
|
.pageUpButton(widgetID, widgetKind)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Image(systemName: "arrow.down")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: buttonWidth, height: buttonWidth)
|
||||||
|
.opacity(0.3)
|
||||||
|
// .mask(Capsule())
|
||||||
|
.pageDownButton(widgetID, widgetKind)
|
||||||
|
}
|
||||||
|
.padding(.vertical)
|
||||||
|
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func appsListView(reader: GeometryProxy) -> some View {
|
|
||||||
let itemsPerPage = ActiveAppsWidget.Constants.MAX_ROWS_PER_PAGE
|
|
||||||
|
|
||||||
let preferredRowHeight = (reader.size.height / Double(itemsPerPage)) - 8
|
|
||||||
let rowHeight = min(preferredRowHeight, reader.size.height / 2)
|
|
||||||
|
|
||||||
return LazyVStack(spacing: 12) {
|
|
||||||
ForEach(Array(entry.apps.enumerated()), id: \.offset) { index, app in
|
|
||||||
|
|
||||||
appEntryRowView(app: app, rowHeight: rowHeight)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private func appEntryRowView(app: AppSnapshot, rowHeight: Double) -> some View {
|
|
||||||
let icon: UIImage = app.icon ?? UIImage(named: "SideStore")!
|
|
||||||
|
|
||||||
// 1024x1024 images are not supported by previews but supported by device
|
|
||||||
// so we scale the image to 97% so as to reduce its actual size but not too much
|
|
||||||
// to somewhere below value, acceptable by previews ie < 1042x948
|
|
||||||
let scalingFactor = 0.97
|
|
||||||
|
|
||||||
let resizedSize = CGSize(
|
|
||||||
width: icon.size.width * scalingFactor,
|
|
||||||
height: icon.size.height * scalingFactor
|
|
||||||
)
|
|
||||||
|
|
||||||
let resizedIcon = icon.resizing(to: resizedSize)!
|
|
||||||
let cornerRadius = rowHeight / 5.0
|
|
||||||
|
|
||||||
return HStack(spacing: 10) {
|
|
||||||
Image(uiImage: resizedIcon)
|
|
||||||
.resizable()
|
|
||||||
.aspectRatio(contentMode: .fit)
|
|
||||||
.cornerRadius(cornerRadius)
|
|
||||||
|
|
||||||
appDetailsView(app)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
countDownView(app)
|
|
||||||
|
|
||||||
}
|
|
||||||
.frame(height: rowHeight)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private func appDetailsView(_ app: AppSnapshot) -> some View {
|
|
||||||
let daysRemaining = app.expirationDate.numberOfCalendarDays(since: entry.date)
|
|
||||||
|
|
||||||
return VStack(alignment: .leading, spacing: 1) {
|
|
||||||
Text(app.name)
|
|
||||||
.font(.system(size: 15, weight: .semibold, design: .rounded))
|
|
||||||
|
|
||||||
let text = if entry.date > app.expirationDate
|
|
||||||
{
|
|
||||||
Text("Expired")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Text("Expires in \(daysRemaining) ") + (daysRemaining == 1 ? Text("day") : Text("days"))
|
|
||||||
}
|
|
||||||
|
|
||||||
text
|
|
||||||
.font(.system(size: 13, weight: .semibold, design: .rounded))
|
|
||||||
.foregroundStyle(.secondary)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func countDownView(_ app: AppSnapshot) -> some View {
|
|
||||||
Countdown(startDate: app.refreshedDate,
|
|
||||||
endDate: app.expirationDate,
|
|
||||||
currentDate: entry.date,
|
|
||||||
strokeWidth: 3.0) // Slightly thinner circle stroke width
|
|
||||||
.background {
|
|
||||||
Color.black.opacity(0.1)
|
|
||||||
.mask(Capsule())
|
|
||||||
.padding(.all, -5)
|
|
||||||
}
|
|
||||||
.font(.system(size: 16, weight: .semibold, design: .rounded))
|
|
||||||
// this modifier invalidates the view (disables user interaction and shows a blinking effect)
|
|
||||||
.invalidatableContent()
|
|
||||||
.activatesRefreshAllAppsIntent()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private func navigationBarView() -> some View {
|
|
||||||
let buttonWidth: CGFloat = 16
|
|
||||||
let widgetID = entry.context?.ID
|
|
||||||
|
|
||||||
return VStack {
|
|
||||||
Image(systemName: "arrow.up")
|
|
||||||
.resizable()
|
|
||||||
.frame(width: buttonWidth, height: buttonWidth)
|
|
||||||
.opacity(0.3)
|
|
||||||
// .mask(Capsule())
|
|
||||||
.pageUpButton(widgetID, widgetKind)
|
|
||||||
|
|
||||||
Spacer()
|
|
||||||
|
|
||||||
Image(systemName: "arrow.down")
|
|
||||||
.resizable()
|
|
||||||
.frame(width: buttonWidth, height: buttonWidth)
|
|
||||||
.opacity(0.3)
|
|
||||||
// .mask(Capsule())
|
|
||||||
.pageDownButton(widgetID, widgetKind)
|
|
||||||
}
|
|
||||||
.padding(.vertical)
|
|
||||||
}
|
|
||||||
|
|
||||||
private var placeholder: some View {
|
private var placeholder: some View {
|
||||||
Text("App Not Found")
|
Text("App Not Found")
|
||||||
.font(.system(.body, design: .rounded))
|
.font(.system(.body, design: .rounded))
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ public class PaginationDataHolder {
|
|||||||
self.currentPageindex = startPageIndex
|
self.currentPageindex = startPageIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
init(other: PaginationDataHolder) {
|
||||||
|
self.itemsPerPage = other.itemsPerPage
|
||||||
|
self.currentPageindex = other.currentPageindex
|
||||||
|
}
|
||||||
|
|
||||||
public enum PageLimitResult{
|
public enum PageLimitResult{
|
||||||
case null
|
case null
|
||||||
case empty
|
case empty
|
||||||
|
|||||||
Reference in New Issue
Block a user