Add AfterAsync to view extensions
This commit is contained in:
parent
772f4b3da8
commit
c707b136c2
|
@ -1195,7 +1195,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 125;
|
||||
CURRENT_PROJECT_VERSION = 126;
|
||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = VernissageWidget/Info.plist;
|
||||
|
@ -1223,7 +1223,7 @@
|
|||
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
|
||||
CODE_SIGN_ENTITLEMENTS = VernissageWidget/VernissageWidgetExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 125;
|
||||
CURRENT_PROJECT_VERSION = 126;
|
||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = VernissageWidget/Info.plist;
|
||||
|
@ -1250,7 +1250,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 125;
|
||||
CURRENT_PROJECT_VERSION = 126;
|
||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = VernissageShare/Info.plist;
|
||||
|
@ -1277,7 +1277,7 @@
|
|||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = VernissageShare/VernissageShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 125;
|
||||
CURRENT_PROJECT_VERSION = 126;
|
||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = VernissageShare/Info.plist;
|
||||
|
@ -1426,7 +1426,7 @@
|
|||
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 125;
|
||||
CURRENT_PROJECT_VERSION = 126;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
|
@ -1467,7 +1467,7 @@
|
|||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Vernissage/Vernissage.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 125;
|
||||
CURRENT_PROJECT_VERSION = 126;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"Vernissage/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = B2U9FEKYP8;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
|
|
|
@ -249,8 +249,8 @@ struct MainView: View {
|
|||
HapticService.shared.fireHaptic(of: .tabSelection)
|
||||
|
||||
if viewMode == .search {
|
||||
hideKeyboard()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||
self.hideKeyboard()
|
||||
self.asyncAfter(0.3) {
|
||||
self.viewMode = newViewMode
|
||||
}
|
||||
} else {
|
||||
|
@ -262,8 +262,8 @@ struct MainView: View {
|
|||
HapticService.shared.fireHaptic(of: .buttonPress)
|
||||
|
||||
if viewMode == .search {
|
||||
hideKeyboard()
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
|
||||
self.hideKeyboard()
|
||||
self.asyncAfter(0.3) {
|
||||
self.tryToSwitch(account)
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -74,7 +74,7 @@ struct AccountsSectionView: View {
|
|||
// When we are deleting active user then we have to switch to sing in view.
|
||||
if shouldClearApplicationState {
|
||||
// We have to do this after animation of deleting row is ended.
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
|
||||
self.asyncAfter(0.5) {
|
||||
ApplicationSettingsHandler.shared.set(accountId: nil)
|
||||
self.applicationState.clearApplicationState()
|
||||
self.client.clearAccount()
|
||||
|
|
|
@ -141,7 +141,7 @@ struct ImageViewer: View {
|
|||
self.accumulatedOffset = CGSize.zero
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) {
|
||||
self.asyncAfter(0.35) {
|
||||
withoutAnimation {
|
||||
self.dismiss()
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ struct ImageViewer: View {
|
|||
self.currentOffset = self.calculateStartingOffset()
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) {
|
||||
self.asyncAfter(0.35) {
|
||||
withoutAnimation {
|
||||
self.dismiss()
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ struct ImagesCarousel: View {
|
|||
self.recalculateImageHeight(attachment: attachment, imageData: imageData)
|
||||
}
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.4) {
|
||||
self.asyncAfter(0.4) {
|
||||
attachment.set(data: imageData)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,16 @@
|
|||
//
|
||||
// File.swift
|
||||
//
|
||||
//
|
||||
// Created by Marcin Czachurski on 22/04/2023.
|
||||
// https://mczachurski.dev
|
||||
// Copyright © 2023 Marcin Czachurski and the repository contributors.
|
||||
// Licensed under the Apache License 2.0.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
public extension View {
|
||||
func asyncAfter(_ time: Double, operation: @escaping () -> Void) {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + time) {
|
||||
operation()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue