GBA002/Delta/Extensions/GameViewController+ExperimentalToasts.swift
Riley Testut 7fceccc114 [Experimental Feature] Toast Notifications (#244)
commit c340cf842fbf5fea476a6637efe4928dbd734eba
Author: Chris Rittenhouse <dev@litritt.com>
Date:   Thu Apr 27 17:24:30 2023 -0400

    Addresses Riley's requested changes
    - Minor code structure change in extension
    - Minor changes to text and phrasing

commit 2a928dfa637dfb503e861dc863f6f85f5240941a
Author: Chris Rittenhouse <dev@litritt.com>
Date:   Wed Apr 26 20:11:38 2023 -0400

    Adds implementation for Toast Notifications Experimental Feature

commit 4fa7d139669994eff888c41bf7af9ac0b6cd2a75
Author: Chris Rittenhouse <dev@litritt.com>
Date:   Wed Apr 26 20:11:04 2023 -0400

    Adds @Feature and @Options for Toast Notifications Experimental Feature

Co-authored-by: Chris Rittenhouse <dev@litritt.com>
2023-04-28 15:32:13 -05:00

26 lines
751 B
Swift

//
// GameViewController+ExperimentalToasts.swift
// Delta
//
// Created by Chris Rittenhouse on 4/26/23.
// Copyright © 2023 Riley Testut. All rights reserved.
//
import Roxas
extension GameViewController
{
func presentExperimentalToastView(_ text: String)
{
guard ExperimentalFeatures.shared.toastNotifications.isEnabled else { return }
DispatchQueue.main.async {
let toastView = RSTToastView(text: text, detailText: nil)
toastView.edgeOffset.vertical = 8
toastView.textLabel.textAlignment = .center
toastView.presentationEdge = .top
toastView.show(in: self.view, duration: ExperimentalFeatures.shared.toastNotifications.duration)
}
}
}