Post

Replies

Boosts

Views

Activity

how to use a 3D short cut with the totally closed application
I'm soliciting you because I'm having a problem using the 3D short cut for my ios application in uikit in the AppDelegate file but it's impossible to redirect the route when the user has completely killed the application. It works as a background application. I'd like it to redirect to the searchPage search page when the application is fully closed and the user clicks on search with 3D touch. final class AppDelegate: UIResponder, UIApplicationDelegate { lazy var window: UIWindow? = { return UIWindow(frame: UIScreen.main.bounds) }() private let appDependencyContainer = Container() private let disposeBag = DisposeBag() var pendingDeeplink: String? private lazy var onboardingNavigationController: UINavigationController = { let navigationController = UINavigationController(nibName: nil, bundle: nil) navigationController.setNavigationBarHidden(true, animated: false) return navigationController }() private func handleShortcutItem(_ shortcutItem: UIApplicationShortcutItem) { guard let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, let window = windowScene.windows.first(where: { $0.isKeyWindow }), let rootVC = window.rootViewController else { DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in self?.handleShortcutItem(shortcutItem) } return } if let presentedVC = rootVC.presentedViewController { presentedVC.dismiss(animated: !UIAccessibility.isReduceMotionEnabled) { [weak self] in self?.executeShortcutNavigation(shortcutItem) } } else { executeShortcutNavigation(shortcutItem) } } private func executeShortcutNavigation(_ shortcutItem: UIApplicationShortcutItem) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in guard let self = self else { return } switch shortcutItem.type { case ShortcutType.searchAction.rawValue: self.mainRouter.drive(to: .searchPage(.show), origin: AppRoutingOrigin()) case ShortcutType.playAction.rawValue: self.mainRouter.drive(to: .live(channel: Channel(), appTabOrigin: AppTabOrigin.navigation.rawValue), origin: AppRoutingOrigin()) case ShortcutType.myListHistoryAction.rawValue: self.mainRouter.drive(to: .myList(.history), origin: AppRoutingOrigin()) default: break } } } What I've tried: Adding delays with DispatchQueue.main.asyncAfter Checking for window availability and rootViewController Dismissing presented view controllers before navigation Environment: iOS 15+ Swift 6 Using custom router system (mainRouter) App supports both SwiftUI and UIKit Questions: What's the best practice for handling shortcuts on cold launch vs warm launch? How can I ensure the router is properly initialized before navigation?
0
0
66
Jul ’25
My TextField in my view doesn't work when touch on the preview or the simulator
Hello My TextField in my view doesn't work when touch on the preview or the // MARK: - Body var body: some View { VStack { Spacer() VStack(alignment: .leading, spacing: 5) { Text("Welcome!") .fontWeight(.bold) .font(.title) Text("Enter your e-mail in order to log in or create an account") } VStack(alignment: .leading, spacing: 15) { Spacer() HStack(spacing: 15) { Image("message") .font(.system(size: 20)) TextField("Email", text: $email) .font(.callout) .frame(maxWidth: .infinity, alignment: .leading) .lineSpacing(28) } .padding(.horizontal, 15) .frame(maxWidth: .infinity, maxHeight: 55) .background(Color.white) .cornerRadius(5) .overlay(RoundedRectangle(cornerRadius: 5).stroke(Color.black, lineWidth: 1)) .padding(.top, -10) Spacer() } .frame(width: 343, height: 55) HStack { Rectangle() .fill(Color.black) .frame(height: 3) Text("or continue with") .frame(width: 150, height: 100) Rectangle() .fill(Color.black) .frame(height: 3) } Thanks you for help
0
0
241
Apr ’23
No exact matches in call to instance method 'scaleEffect' ?
Hello as I am a beginner in swiftUI I am currently following a training on the udemy platform but I encounter a problem that I can't solve. As I'm a beginner I still have trouble understanding some errors, if you could please enlighten me in my learning it would be nice I have the following error "No exact matches in call to instance method 'scaleEffect'" Thanking you in advance // // ContentView.swift // Pinch // Created by Jules Fakhouri on 23/11/2022. // import SwiftUI struct ContentView: View { // MARK: - PROPERTY @State private var isAnimating: Bool = false @State private var ismageScale: CGFloat = 1 // MARK: - FUNCTION // MARK: - CONTENT var body: some View { NavigationView { ZStack{ // MARK - PAGE IMAGE Image("magazine-front-cover") .resizable() .aspectRatio(contentMode: .fit) .cornerRadius(10) .padding() .shadow(color: .black.opacity(0.2), radius:12, x: 2, y: 2) .opacity(isAnimating ? 1 : 0) .scaleEffect(imageScale) // MARK - 1 TAP Gesture .onTapGesture(count: 2, perform: { if imageScale == 1 { withAnimation(.spring()) { imageScale = 5 } } else { withAnimation(.spring()) { imageScale = 1 } } }) } // ZSTACK .navigationTitle("Pinch & Zoom") .navigationBarTitleDisplayMode(.inline) .onAppear(perform: { withAnimation(.linear(duration: 1)) { isAnimating = true } }) } // NAVIGATION .navigationViewStyle(.stack) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } }
1
0
2.2k
Nov ’22