UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

MacOS SwiftUI Screenshot

Forums > macOS

I want my MacOS app to be able to take a screenshot of a selected area only, not the whole screen.

I know I can use the build in capabilities of MacOS "Shift+Command+4" and use Pauls code-> to detect the action, but I realy want the functionallity to be handle in app.

I've come accross this piece of code but can't get it to run as my knowledge of extensions is in its infancy: https://gist.github.com/SatoTakeshiX/39e111aa93f896e58c74fdc13d19ba0a

I have alot to learn and any help would be appreciated.

4      

This open-source library (https://github.com/nirix/swift-screencapture) provides the API to capture entire screen, capture an area, and record screen. I think this might be useful to you.

4      

Oh, great, thanks for the info! I am interested in developing antivirus for macOS that would focus on keeping software settings intact or flagging on an attempt to introduce changes. There are apps around that escalate privalages despite being what is called a 100% legit app e.g. https://applehelpwriter.com/2016/08/29/discovering-how-dropbox-hacks-your-mac/. There are apps that are rather ill-famed yet still are not recognized as culprits. Yahoo redirect generic virus is a good example. So I wonder if Swift is a good language to develop AV focusing on privilage escalation issues, in partticular, I wonder if DetectX Swift could be used as a stub https://sqwarq.com/detectx/? Sorry, the question is a bit irrelevenat and obscure, I appreciate any follow-up.

4      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.