Post

Replies

Boosts

Views

Activity

UIPickerView like the one in the apple native calender app
Dear forum, I have programmed an app with an UIPickerView being presented modally up and running, with an UITextField as the initiator for the presentation. I like to use the kind of animation of the UIPickerView in the manner, as you can find it in the Apple native calender app, i.e. changing the beginning time or others. See the following screenshots for a better understanding: You see the calender app before and during the time of editing the time value for a new appointment. The UIPickerView is shown with an animation pushing down the rest of the view after “Beginn”. Does anybody know, how to do this including the animation programmaticaly in Swift or where I can find an example or some hints, how to programm it? Thanks in advance Best Thomas
0
0
316
Jul ’22
SwiftUI on macOS, app generating a png file on the desktop from a screenshot made to the pasteboard
Hi all, I've written a macOS swiftUI app, which checks the availability of a website, i.e. to my cloud. In the case, the access is lost, I'm creating a screenshot to the pasteboard and I'm generating a POST request to a PHP script on my webserver, to send an information email to my email address. I'm using the following 2 functions, to generate the screenshot and save it to the pasteboard. All based on the tutorial (very good!) from Grace Huang (https://www.youtube.com/watch?v=7nnYsRrtweA) func erfolgreichEinScreenshotErstellt() -> Bool{ let task = Process() task.launchPath = "/usr/sbin/screencapture" task.arguments = ["-c"] task.launch() task.waitUntilExit() let status = task.terminationStatus return status == 0 } func dasBildAbholenUndZeigen() -> NSImage { let pasteboard = NSPasteboard.general guard pasteboard.canReadItem(withDataConformingToTypes: NSImage.imageTypes) else{ return NSImage() } guard let image = NSImage(pasteboard: pasteboard) else { return NSImage() } let tiffData = image.tiffRepresentation! let pngData = NSBitmapImageRep(data: tiffData)?.representation(using: .png, properties: [:]) return image } Everything works fine till here! The last step I like to do, I need a little help for: how can I save the "image" as a .png-file with a given name to my desktop for further use, i.e. generating a pdf file or so from the png file. As you can see, I've tried the following code but than I've got stuck: ......... let tiffData = image.tiffRepresentation! let pngData = NSBitmapImageRep(data: tiffData)?.representation(using: .png, properties: [:]) Thanks in advance, if someone likes to help me with some code or a hint to a solution idea. Best Thomas
2
0
484
Sep ’23