Post

Replies

Boosts

Views

Activity

Reply to XCUIElement click event outside of testing framework
I don't think you can access another app due to sandboxing and other security measures. It might be easier to just call the event handler yourself, but you can trigger an event on a control. https://stackoverflow.com/questions/4028734/how-to-programmatically-fake-a-touch-event-to-a-uibutton That is a little old, but it should work, depending on the type of control involved. There isn't a single way to simulate events though because of differences in the controls.
Topic: App & System Services SubTopic: General Tags:
Jan ’22
Reply to String inerpolation issue using swift 5...
This is the exact code being used. this is the where I'm getting the time stamp, message is a text string let messageToLog = "\(BaseTimeSupport.formatDateTime(.now)) - \(message)" this is the time stamp formatter static func formatDateTime(_ date: Date, usingFormat: String = "MM/dd/yyyy HH:mm:ss") -> String { let dateFormatter = DateFormatter() dateFormatter.locale = .current dateFormatter.dateFormat = usingFormat dateFormatter.calendar = Calendar(identifier: .gregorian) return dateFormatter.string(from: date) }
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’22
Reply to String inerpolation issue using swift 5...
Worth a thought for sure... static func relogSavedLogMessages() { reloggingSavedLogs = true let _savedLogMessages = Array(savedLogMessage) savedLogMessage = [] for message in _savedLogMessages { logMessage(level: .info, functionName: #function, category: Constants.logging.music, formattedMessage: "Relogging - %@", parameters: message) } reloggingSavedLogs = false if crashNeedsToBeLogged { /// log the crash crashNeedsToBeLogged = false BaseLoggingSupport.logMessage(level: .crash, functionName: #function, category: Constants.logging.music, formattedMessage: "App Crash Detected") BaseUISupport.postErrorMessage("App Crash Detected", obj: nil, error: nil, errorType: .red) } } BaseLoggingSupport.logMessage is essentially a wrapper around the OSLog functionality. I had starting the app before the api last changed and decided to ensure I would only have to adjust one location if it changed again. I'm seeing the current time in the text such as relogSavedLogMessage() - Relogging - 03/01/2022 12:57:53 - countOfFetch(table:Predicate:) - Success 72 The logging time stamp for when the relogging shows after it as 03/01 125753
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’22
Reply to How to hide share/action button from QLPreviewController in iOS 10.X
The best I managed with it being presented full screen is to set the right navigation item to be a close button and set the navigation controller toolbar as hidden in viewDidLoad. This leaves a blank toolbar, but that at least gets rid of the share button. Looking at the screen using xcode's view inspector, it looks like it might be creating a toolbar since I see two toolbars stacked on one another, a blank one and the one with the share button. I also set the toolbar to hidden in willLayoutSubviews That works on a compact screen, aka portrait on a phone, but in landscape the share button becomes a second button to the left of my close button. I just spotted the landscape issue and am still looking into it.
Topic: App & System Services SubTopic: General Tags:
Mar ’22
Reply to How to hide share/action button from QLPreviewController in iOS 10.X
One additional horrible hack is to check the right bar button items list to see if it has more items than you expect, and if so, drop the first one. In my case I was expecting one, so I set it to be just the last item in the list. I have the advantage of not needing my app to go to the store, so I don't know if this combination of things would be allowed in store apps.
Topic: App & System Services SubTopic: General Tags:
Mar ’22
Reply to Command Center media buttons is not syncing with App's media state Swift
Your app needs to update the control state, enable/disable, based on its control state. I have this function that handles a change in the player state /// updates the media player controls to reflect the new player status /// - Parameter status: player status flags func updateUI(status: PlayerStatus) { ModuleData.singleton.mediaCommandCenter.playCommand.isEnabled = status.intersects(with: .play) ModuleData.singleton.mediaCommandCenter.stopCommand.isEnabled = status.intersects(with: .stop) ModuleData.singleton.mediaCommandCenter.pauseCommand.isEnabled = status.intersects(with: .pause) ModuleData.singleton.mediaCommandCenter.nextTrackCommand.isEnabled = status.intersects(with: .skipForward) ModuleData.singleton.mediaCommandCenter.togglePlayPauseCommand.isEnabled = status.intersects(with: [.stop, .play, .pause]) ModuleData.singleton.mediaCommandCenter.previousTrackCommand.isEnabled = status.intersects(with: .skipBackward) ModuleData.singleton.mediaCommandCenter.skipForwardCommand.isEnabled = status.intersects(with: .skipBackwardTime) ModuleData.singleton.mediaCommandCenter.skipBackwardCommand.isEnabled = status.intersects(with: .skipBackwardTime) ModuleData.singleton.mediaCommandCenter.seekForwardCommand.isEnabled = status.intersects(with: .seekForward) ModuleData.singleton.mediaCommandCenter.seekBackwardCommand.isEnabled = status.intersects(with: .seekBackward) } The status values are a bit mask enum with various controls enabled/disabled.
Topic: Media Technologies SubTopic: General Tags:
Apr ’23
Reply to Crash when triggering sheet presentation from a task
I think I know the problem. You are accessing the content property value as it is at that moment, but you access the isPresented property in what amounts to the will set call, so you are seeing the future presented value, but the present content. I'm not sure of a fix for it since it becomes immutable if you remove the state wrapper.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’23