LAST CHANCE: Save 50% on all my Swift books and bundles! >>

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 Essential Developer.

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until July 28th.

Click to save your free spot now

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.