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: #18 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
48 lines
1.1 KiB
Swift
48 lines
1.1 KiB
Swift
//
|
|
// 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
|
|
)
|
|
}
|
|
}
|
|
|
|
}
|