[Framework] Empty and error state handling for the Feed list (#18)
This PR contains the work done to implement the handling of empty and error states for the `FeedListViewController` view controller in the `Feed` framework. Reviewed-on: rock-n-code/app-reviews#18 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #18.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// FeedUnavailableView.swift
|
||||
// Feed
|
||||
//
|
||||
// Created by Javier Cicchelli on 22/03/2024.
|
||||
// Copyright © 2024 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
import ReviewsUIKit
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
|
||||
|
||||
final class FeedUnavailableView: UIHostingController<UnavailableView> {
|
||||
|
||||
// MARK: Initialisers
|
||||
convenience init(
|
||||
systemImage: String,
|
||||
title: String,
|
||||
description: String,
|
||||
button: String? = nil,
|
||||
action: (() -> Void)? = nil
|
||||
) {
|
||||
self.init(rootView: .init(
|
||||
systemImage: systemImage,
|
||||
title: title,
|
||||
description: description,
|
||||
button: button,
|
||||
action: action
|
||||
))
|
||||
}
|
||||
|
||||
// MARK: Functions
|
||||
override func viewSafeAreaInsetsDidChange() {
|
||||
super.viewSafeAreaInsetsDidChange()
|
||||
|
||||
if view.safeAreaInsets.bottom > 0 {
|
||||
additionalSafeAreaInsets = .init(
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: -view.safeAreaInsets.bottom,
|
||||
right: 0
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user