├── ScreenCapture.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcshareddata
│ └── xcschemes
│ │ └── ScreenCapture.xcscheme
└── project.pbxproj
├── .gitignore
├── ScreenCapture.podspec
├── ScreenCapture
├── ScreenCapture.h
├── Info.plist
├── ScreenCapture.swift
└── ScreenRecorder.swift
├── LICENSE
├── Example
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── AppDelegate.swift
└── Base.lproj
│ └── MainMenu.xib
└── README.md
/ScreenCapture.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac OS X
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata
15 | *.xccheckout
16 | *.moved-aside
17 | DerivedData
18 | *.hmap
19 | *.ipa
20 | *.xcuserstate
21 |
22 | # Carthage
23 | Carthage/Build
24 |
--------------------------------------------------------------------------------
/ScreenCapture.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "ScreenCapture"
3 | s.version = "0.1.0"
4 | s.summary = "Easily capture the screen on OS X."
5 | s.homepage = "https://github.com/nirix/swift-screencapture"
6 | s.license = "MIT"
7 | s.author = "Jack P."
8 | s.platform = :osx, "10.9"
9 | s.source = { :git => "https://github.com/nirix/swift-screencapture.git", :tag => "v0.1.0" }
10 | s.source_files = "ScreenCapture/*.swift"
11 | end
12 |
--------------------------------------------------------------------------------
/ScreenCapture/ScreenCapture.h:
--------------------------------------------------------------------------------
1 | //
2 | // ScreenCapture.h
3 | // ScreenCapture
4 | //
5 | // Created by Jack P. on 11/12/2015.
6 | // Copyright © 2015 Jack P. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for ScreenCapture.
12 | FOUNDATION_EXPORT double ScreenCaptureVersionNumber;
13 |
14 | //! Project version string for ScreenCapture.
15 | FOUNDATION_EXPORT const unsigned char ScreenCaptureVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ScreenCapture/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSHumanReadableCopyright
24 | Copyright © 2015 Jack P. All rights reserved.
25 | NSPrincipalClass
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015 Jack P.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/Example/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "mac",
5 | "size" : "16x16",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "mac",
10 | "size" : "16x16",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "mac",
15 | "size" : "32x32",
16 | "scale" : "1x"
17 | },
18 | {
19 | "idiom" : "mac",
20 | "size" : "32x32",
21 | "scale" : "2x"
22 | },
23 | {
24 | "idiom" : "mac",
25 | "size" : "128x128",
26 | "scale" : "1x"
27 | },
28 | {
29 | "idiom" : "mac",
30 | "size" : "128x128",
31 | "scale" : "2x"
32 | },
33 | {
34 | "idiom" : "mac",
35 | "size" : "256x256",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "mac",
40 | "size" : "256x256",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "mac",
45 | "size" : "512x512",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "mac",
50 | "size" : "512x512",
51 | "scale" : "2x"
52 | }
53 | ],
54 | "info" : {
55 | "version" : 1,
56 | "author" : "xcode"
57 | }
58 | }
--------------------------------------------------------------------------------
/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | LSMinimumSystemVersion
26 | $(MACOSX_DEPLOYMENT_TARGET)
27 | NSHumanReadableCopyright
28 | Copyright © 2015 Jack P. All rights reserved.
29 | NSMainNibFile
30 | MainMenu
31 | NSPrincipalClass
32 | NSApplication
33 |
34 |
35 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ScreenCapture []() [](https://github.com/Carthage/Carthage) [](https://cocoapods.org/pods/ScreenCapture)
2 |
3 | This framework makes capturing screenshots within OS X easy.
4 |
5 | To capture a region of the screen, it makes use of `NSTask` to call `/usr/sbin/screencapture`.
6 |
7 | ## Carthage
8 |
9 | `github "nirix/swift-screencapture"`
10 |
11 | ## How to use it
12 |
13 | An example application can be found in the `Example` directory.
14 |
15 | ### Screenshots
16 |
17 | ```swift
18 | import ScreenCapture
19 |
20 | // Capture part of the screen
21 | let regionUrl = ScreenCapture.captureRegion("/path/to/save/to.png")
22 |
23 | // Capture the entire screen
24 | let screenUrl = ScreenCapture.captureScreen("/path/to/save/to.png")
25 | ```
26 |
27 | ### Record screen
28 |
29 | ```swift
30 | import ScreenCapture
31 |
32 | let recorder = ScreenCapture.recordScreen("/path/to/save/to.mp4")
33 |
34 | recorder.start()
35 | ...
36 | recorder.stop()
37 |
38 | let movieUrl = recorder.destination
39 | ```
40 |
41 | ## License
42 |
43 | This framework and it's code is released under the MIT license.
44 |
--------------------------------------------------------------------------------
/ScreenCapture/ScreenCapture.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ScreenCapture.swift
3 | // ScreenCapture
4 | //
5 | // Created by Jack P. on 11/12/2015.
6 | // Copyright © 2015 Jack P. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | // -------------------------------------------------------------------
12 | // Allow passing of strings, just convert them to an NSURL.
13 |
14 | public func captureRegion(_ destination: String) -> URL {
15 | return captureRegion(URL(fileURLWithPath: destination))
16 | }
17 |
18 | public func captureScreen(_ destination: String) -> URL {
19 | return captureScreen(URL(fileURLWithPath: destination))
20 | }
21 |
22 | public func recordScreen(_ destination: String) -> ScreenRecorder {
23 | return recordScreen(URL(fileURLWithPath: destination))
24 | }
25 |
26 | // -------------------------------------------------------------------
27 |
28 | public func captureRegion(_ destination: URL) -> URL {
29 | let destinationPath = destination.path as String
30 |
31 | let task = Process()
32 | task.launchPath = "/usr/sbin/screencapture"
33 | task.arguments = ["-i", "-r", destinationPath]
34 | task.launch()
35 | task.waitUntilExit()
36 |
37 | return destination
38 | }
39 |
40 | public func captureScreen(_ destination: URL) -> URL {
41 | let img = CGDisplayCreateImage(CGMainDisplayID())
42 | let dest = CGImageDestinationCreateWithURL(destination as CFURL, kUTTypePNG, 1, nil)
43 | CGImageDestinationAddImage(dest!, img!, nil)
44 | CGImageDestinationFinalize(dest!)
45 |
46 | return destination
47 | }
48 |
49 | public func recordScreen(_ destination: URL) -> ScreenRecorder {
50 | return ScreenRecorder(destination: destination)
51 | }
52 |
--------------------------------------------------------------------------------
/ScreenCapture/ScreenRecorder.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ScreenRecorder.swift
3 | // ScreenCapture
4 | //
5 | // Created by Jack P. on 11/12/2015.
6 | // Copyright © 2015 Jack P. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import AVFoundation
11 |
12 | open class ScreenRecorder: NSObject, AVCaptureFileOutputRecordingDelegate {
13 | let destinationUrl: URL
14 | let session: AVCaptureSession
15 | let movieFileOutput: AVCaptureMovieFileOutput
16 |
17 | open var destination: URL {
18 | get {
19 | return self.destinationUrl
20 | }
21 | }
22 |
23 | public init(destination: URL) {
24 | destinationUrl = destination
25 |
26 | session = AVCaptureSession()
27 | session.sessionPreset = AVCaptureSessionPresetHigh
28 |
29 | let displayId: CGDirectDisplayID = CGDirectDisplayID(CGMainDisplayID())
30 |
31 | let input: AVCaptureScreenInput = AVCaptureScreenInput(displayID: displayId)
32 |
33 |
34 | if session.canAddInput(input) {
35 | session.addInput(input)
36 | }
37 |
38 | movieFileOutput = AVCaptureMovieFileOutput()
39 |
40 | if session.canAddOutput(movieFileOutput) {
41 | session.addOutput(movieFileOutput)
42 | }
43 |
44 | }
45 |
46 | open func start() {
47 | session.startRunning()
48 | movieFileOutput.startRecording(toOutputFileURL: self.destinationUrl, recordingDelegate: self)
49 | }
50 |
51 | open func stop() {
52 | movieFileOutput.stopRecording()
53 | }
54 |
55 | open func capture(
56 | _ captureOutput: AVCaptureFileOutput!,
57 | didFinishRecordingToOutputFileAt outputFileURL: URL!,
58 | fromConnections connections: [Any]!,
59 | error: Error!
60 | ) {
61 | //
62 | session.stopRunning()
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/Example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Example
4 | //
5 | // Created by Jack P. on 11/12/2015.
6 | // Copyright © 2015 Jack P. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 | import AVKit
11 | import AVFoundation
12 | import ScreenCapture
13 |
14 | @NSApplicationMain
15 | class AppDelegate: NSObject, NSApplicationDelegate {
16 |
17 | @IBOutlet weak var window: NSWindow!
18 | @IBOutlet weak var imgView: NSImageView!
19 | @IBOutlet weak var playerView: AVPlayerView!
20 | @IBOutlet weak var startRecordingBtn: NSButton!
21 | @IBOutlet weak var stopRecordingBtn: NSButton!
22 |
23 | let tmpDir: String = NSTemporaryDirectory()
24 | var player: AVPlayer?
25 |
26 | var screenRecorder: ScreenCapture.ScreenRecorder?
27 |
28 | func applicationDidFinishLaunching(aNotification: NSNotification) {
29 | stopRecordingBtn.isEnabled = false
30 | }
31 |
32 | func applicationWillTerminate(aNotification: NSNotification) {
33 | do {
34 | if (FileManager.default.fileExists(atPath: "\(self.tmpDir)captureRegion.png")) {
35 | try FileManager.default.removeItem(atPath: "\(self.tmpDir)captureRegion.png")
36 | }
37 |
38 | if (FileManager.default.fileExists(atPath: "\(self.tmpDir)captureScreen.png")) {
39 | try FileManager.default.removeItem(atPath: "\(self.tmpDir)captureScreen.png")
40 | }
41 |
42 | if (FileManager.default.fileExists(atPath: "\(self.tmpDir)screenRecording.mp4")) {
43 | try FileManager.default.removeItem(atPath: "\(self.tmpDir)screenRecording.mp4")
44 | }
45 | } catch {}
46 | }
47 |
48 | @IBAction func captureRegion(sender: NSButton) {
49 | let imgPath: String = ScreenCapture.captureRegion("\(self.tmpDir)captureRegion.png").path
50 |
51 | if (FileManager.default.fileExists(atPath: imgPath)) {
52 | let img: NSImage = NSImage(contentsOfFile: imgPath)!
53 | imgView.image = img
54 | }
55 | }
56 |
57 | @IBAction func captureScreen(sender: NSButton) {
58 | window.performMiniaturize(sender)
59 | let imgPath: String = ScreenCapture.captureScreen("\(self.tmpDir)captureScreen.png").path
60 | let img: NSImage = NSImage(contentsOfFile: imgPath)!
61 | imgView.image = img
62 | }
63 |
64 | @IBAction func startRecording(sender: NSButton) {
65 | do {
66 | if (FileManager.default.fileExists(atPath: "\(self.tmpDir)screenRecording.mp4")) {
67 | try FileManager.default.removeItem(atPath: "\(self.tmpDir)screenRecording.mp4")
68 | }
69 | } catch {}
70 |
71 | startRecordingBtn.isEnabled = false
72 | stopRecordingBtn.isEnabled = true
73 | screenRecorder = ScreenCapture.recordScreen("\(self.tmpDir)screenRecording.mp4")
74 | screenRecorder!.start()
75 | }
76 |
77 | @IBAction func stopRecording(sender: NSButton) {
78 | screenRecorder!.stop()
79 |
80 | startRecordingBtn.isEnabled = true
81 | stopRecordingBtn.isEnabled = false
82 |
83 | debugPrint(screenRecorder!.destination)
84 | }
85 |
86 |
87 | // It's better to seperate the playback function cause the stopRunning / writing video process may take some time
88 | @IBAction func playback(_ sender: NSButton) {
89 |
90 | self.player = AVPlayer(url: screenRecorder!.destination)
91 | self.playerView.player = self.player
92 | self.playerView.player?.play()
93 | }
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/ScreenCapture.xcodeproj/xcshareddata/xcschemes/ScreenCapture.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
71 |
72 |
73 |
74 |
75 |
76 |
82 |
83 |
89 |
90 |
91 |
92 |
94 |
95 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/ScreenCapture.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 041C2CA21C1AF2FD007346C6 /* ScreenRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 041C2CA11C1AF2FD007346C6 /* ScreenRecorder.swift */; };
11 | 047C40AF1C1A294700D6B267 /* ScreenCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 047C40AE1C1A294700D6B267 /* ScreenCapture.h */; settings = {ATTRIBUTES = (Public, ); }; };
12 | 047C40C61C1A2A2D00D6B267 /* ScreenCapture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047C40C51C1A2A2D00D6B267 /* ScreenCapture.swift */; };
13 | 047C40CE1C1A2AFA00D6B267 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047C40CD1C1A2AFA00D6B267 /* AppDelegate.swift */; };
14 | 047C40D01C1A2AFA00D6B267 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 047C40CF1C1A2AFA00D6B267 /* Assets.xcassets */; };
15 | 047C40D31C1A2AFA00D6B267 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 047C40D11C1A2AFA00D6B267 /* MainMenu.xib */; };
16 | 047C40F41C1A2D2D00D6B267 /* ScreenCapture.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 047C40AB1C1A294700D6B267 /* ScreenCapture.framework */; };
17 | 047C40F51C1A2D2D00D6B267 /* ScreenCapture.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 047C40AB1C1A294700D6B267 /* ScreenCapture.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 047C40F61C1A2D2D00D6B267 /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 047C40A21C1A294700D6B267 /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 047C40AA1C1A294700D6B267;
26 | remoteInfo = ScreenCapture;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXCopyFilesBuildPhase section */
31 | 047C40F81C1A2D2D00D6B267 /* Embed Frameworks */ = {
32 | isa = PBXCopyFilesBuildPhase;
33 | buildActionMask = 2147483647;
34 | dstPath = "";
35 | dstSubfolderSpec = 10;
36 | files = (
37 | 047C40F51C1A2D2D00D6B267 /* ScreenCapture.framework in Embed Frameworks */,
38 | );
39 | name = "Embed Frameworks";
40 | runOnlyForDeploymentPostprocessing = 0;
41 | };
42 | /* End PBXCopyFilesBuildPhase section */
43 |
44 | /* Begin PBXFileReference section */
45 | 041C2CA11C1AF2FD007346C6 /* ScreenRecorder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenRecorder.swift; sourceTree = ""; };
46 | 047C40AB1C1A294700D6B267 /* ScreenCapture.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ScreenCapture.framework; sourceTree = BUILT_PRODUCTS_DIR; };
47 | 047C40AE1C1A294700D6B267 /* ScreenCapture.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScreenCapture.h; sourceTree = ""; };
48 | 047C40B01C1A294700D6B267 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 047C40C51C1A2A2D00D6B267 /* ScreenCapture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenCapture.swift; sourceTree = ""; };
50 | 047C40CB1C1A2AFA00D6B267 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 047C40CD1C1A2AFA00D6B267 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
52 | 047C40CF1C1A2AFA00D6B267 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
53 | 047C40D21C1A2AFA00D6B267 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
54 | 047C40D41C1A2AFA00D6B267 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
55 | /* End PBXFileReference section */
56 |
57 | /* Begin PBXFrameworksBuildPhase section */
58 | 047C40A71C1A294700D6B267 /* Frameworks */ = {
59 | isa = PBXFrameworksBuildPhase;
60 | buildActionMask = 2147483647;
61 | files = (
62 | );
63 | runOnlyForDeploymentPostprocessing = 0;
64 | };
65 | 047C40C81C1A2AFA00D6B267 /* Frameworks */ = {
66 | isa = PBXFrameworksBuildPhase;
67 | buildActionMask = 2147483647;
68 | files = (
69 | 047C40F41C1A2D2D00D6B267 /* ScreenCapture.framework in Frameworks */,
70 | );
71 | runOnlyForDeploymentPostprocessing = 0;
72 | };
73 | /* End PBXFrameworksBuildPhase section */
74 |
75 | /* Begin PBXGroup section */
76 | 047C40A11C1A294700D6B267 = {
77 | isa = PBXGroup;
78 | children = (
79 | 047C40AD1C1A294700D6B267 /* ScreenCapture */,
80 | 047C40CC1C1A2AFA00D6B267 /* Example */,
81 | 047C40AC1C1A294700D6B267 /* Products */,
82 | );
83 | sourceTree = "";
84 | };
85 | 047C40AC1C1A294700D6B267 /* Products */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 047C40AB1C1A294700D6B267 /* ScreenCapture.framework */,
89 | 047C40CB1C1A2AFA00D6B267 /* Example.app */,
90 | );
91 | name = Products;
92 | sourceTree = "";
93 | };
94 | 047C40AD1C1A294700D6B267 /* ScreenCapture */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 047C40AE1C1A294700D6B267 /* ScreenCapture.h */,
98 | 047C40C51C1A2A2D00D6B267 /* ScreenCapture.swift */,
99 | 041C2CA11C1AF2FD007346C6 /* ScreenRecorder.swift */,
100 | 047C40B01C1A294700D6B267 /* Info.plist */,
101 | );
102 | path = ScreenCapture;
103 | sourceTree = "";
104 | };
105 | 047C40CC1C1A2AFA00D6B267 /* Example */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 047C40CD1C1A2AFA00D6B267 /* AppDelegate.swift */,
109 | 047C40CF1C1A2AFA00D6B267 /* Assets.xcassets */,
110 | 047C40D11C1A2AFA00D6B267 /* MainMenu.xib */,
111 | 047C40D41C1A2AFA00D6B267 /* Info.plist */,
112 | );
113 | path = Example;
114 | sourceTree = "";
115 | };
116 | /* End PBXGroup section */
117 |
118 | /* Begin PBXHeadersBuildPhase section */
119 | 047C40A81C1A294700D6B267 /* Headers */ = {
120 | isa = PBXHeadersBuildPhase;
121 | buildActionMask = 2147483647;
122 | files = (
123 | 047C40AF1C1A294700D6B267 /* ScreenCapture.h in Headers */,
124 | );
125 | runOnlyForDeploymentPostprocessing = 0;
126 | };
127 | /* End PBXHeadersBuildPhase section */
128 |
129 | /* Begin PBXNativeTarget section */
130 | 047C40AA1C1A294700D6B267 /* ScreenCapture */ = {
131 | isa = PBXNativeTarget;
132 | buildConfigurationList = 047C40BF1C1A294700D6B267 /* Build configuration list for PBXNativeTarget "ScreenCapture" */;
133 | buildPhases = (
134 | 047C40A61C1A294700D6B267 /* Sources */,
135 | 047C40A71C1A294700D6B267 /* Frameworks */,
136 | 047C40A81C1A294700D6B267 /* Headers */,
137 | 047C40A91C1A294700D6B267 /* Resources */,
138 | );
139 | buildRules = (
140 | );
141 | dependencies = (
142 | );
143 | name = ScreenCapture;
144 | productName = ScreenCapture;
145 | productReference = 047C40AB1C1A294700D6B267 /* ScreenCapture.framework */;
146 | productType = "com.apple.product-type.framework";
147 | };
148 | 047C40CA1C1A2AFA00D6B267 /* Example */ = {
149 | isa = PBXNativeTarget;
150 | buildConfigurationList = 047C40EB1C1A2AFA00D6B267 /* Build configuration list for PBXNativeTarget "Example" */;
151 | buildPhases = (
152 | 047C40C71C1A2AFA00D6B267 /* Sources */,
153 | 047C40C81C1A2AFA00D6B267 /* Frameworks */,
154 | 047C40C91C1A2AFA00D6B267 /* Resources */,
155 | 047C40F81C1A2D2D00D6B267 /* Embed Frameworks */,
156 | );
157 | buildRules = (
158 | );
159 | dependencies = (
160 | 047C40F71C1A2D2D00D6B267 /* PBXTargetDependency */,
161 | );
162 | name = Example;
163 | productName = Example;
164 | productReference = 047C40CB1C1A2AFA00D6B267 /* Example.app */;
165 | productType = "com.apple.product-type.application";
166 | };
167 | /* End PBXNativeTarget section */
168 |
169 | /* Begin PBXProject section */
170 | 047C40A21C1A294700D6B267 /* Project object */ = {
171 | isa = PBXProject;
172 | attributes = {
173 | LastSwiftUpdateCheck = 0720;
174 | LastUpgradeCheck = 0830;
175 | ORGANIZATIONNAME = nirix.net;
176 | TargetAttributes = {
177 | 047C40AA1C1A294700D6B267 = {
178 | CreatedOnToolsVersion = 7.2;
179 | LastSwiftMigration = 0830;
180 | };
181 | 047C40CA1C1A2AFA00D6B267 = {
182 | CreatedOnToolsVersion = 7.2;
183 | };
184 | };
185 | };
186 | buildConfigurationList = 047C40A51C1A294700D6B267 /* Build configuration list for PBXProject "ScreenCapture" */;
187 | compatibilityVersion = "Xcode 3.2";
188 | developmentRegion = English;
189 | hasScannedForEncodings = 0;
190 | knownRegions = (
191 | en,
192 | Base,
193 | );
194 | mainGroup = 047C40A11C1A294700D6B267;
195 | productRefGroup = 047C40AC1C1A294700D6B267 /* Products */;
196 | projectDirPath = "";
197 | projectRoot = "";
198 | targets = (
199 | 047C40AA1C1A294700D6B267 /* ScreenCapture */,
200 | 047C40CA1C1A2AFA00D6B267 /* Example */,
201 | );
202 | };
203 | /* End PBXProject section */
204 |
205 | /* Begin PBXResourcesBuildPhase section */
206 | 047C40A91C1A294700D6B267 /* Resources */ = {
207 | isa = PBXResourcesBuildPhase;
208 | buildActionMask = 2147483647;
209 | files = (
210 | );
211 | runOnlyForDeploymentPostprocessing = 0;
212 | };
213 | 047C40C91C1A2AFA00D6B267 /* Resources */ = {
214 | isa = PBXResourcesBuildPhase;
215 | buildActionMask = 2147483647;
216 | files = (
217 | 047C40D01C1A2AFA00D6B267 /* Assets.xcassets in Resources */,
218 | 047C40D31C1A2AFA00D6B267 /* MainMenu.xib in Resources */,
219 | );
220 | runOnlyForDeploymentPostprocessing = 0;
221 | };
222 | /* End PBXResourcesBuildPhase section */
223 |
224 | /* Begin PBXSourcesBuildPhase section */
225 | 047C40A61C1A294700D6B267 /* Sources */ = {
226 | isa = PBXSourcesBuildPhase;
227 | buildActionMask = 2147483647;
228 | files = (
229 | 047C40C61C1A2A2D00D6B267 /* ScreenCapture.swift in Sources */,
230 | 041C2CA21C1AF2FD007346C6 /* ScreenRecorder.swift in Sources */,
231 | );
232 | runOnlyForDeploymentPostprocessing = 0;
233 | };
234 | 047C40C71C1A2AFA00D6B267 /* Sources */ = {
235 | isa = PBXSourcesBuildPhase;
236 | buildActionMask = 2147483647;
237 | files = (
238 | 047C40CE1C1A2AFA00D6B267 /* AppDelegate.swift in Sources */,
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | /* End PBXSourcesBuildPhase section */
243 |
244 | /* Begin PBXTargetDependency section */
245 | 047C40F71C1A2D2D00D6B267 /* PBXTargetDependency */ = {
246 | isa = PBXTargetDependency;
247 | target = 047C40AA1C1A294700D6B267 /* ScreenCapture */;
248 | targetProxy = 047C40F61C1A2D2D00D6B267 /* PBXContainerItemProxy */;
249 | };
250 | /* End PBXTargetDependency section */
251 |
252 | /* Begin PBXVariantGroup section */
253 | 047C40D11C1A2AFA00D6B267 /* MainMenu.xib */ = {
254 | isa = PBXVariantGroup;
255 | children = (
256 | 047C40D21C1A2AFA00D6B267 /* Base */,
257 | );
258 | name = MainMenu.xib;
259 | sourceTree = "";
260 | };
261 | /* End PBXVariantGroup section */
262 |
263 | /* Begin XCBuildConfiguration section */
264 | 047C40BD1C1A294700D6B267 /* Debug */ = {
265 | isa = XCBuildConfiguration;
266 | buildSettings = {
267 | ALWAYS_SEARCH_USER_PATHS = NO;
268 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
269 | CLANG_CXX_LIBRARY = "libc++";
270 | CLANG_ENABLE_MODULES = YES;
271 | CLANG_ENABLE_OBJC_ARC = YES;
272 | CLANG_WARN_BOOL_CONVERSION = YES;
273 | CLANG_WARN_CONSTANT_CONVERSION = YES;
274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
275 | CLANG_WARN_EMPTY_BODY = YES;
276 | CLANG_WARN_ENUM_CONVERSION = YES;
277 | CLANG_WARN_INFINITE_RECURSION = YES;
278 | CLANG_WARN_INT_CONVERSION = YES;
279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
280 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
281 | CLANG_WARN_UNREACHABLE_CODE = YES;
282 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
283 | CODE_SIGN_IDENTITY = "-";
284 | COPY_PHASE_STRIP = NO;
285 | CURRENT_PROJECT_VERSION = 1;
286 | DEBUG_INFORMATION_FORMAT = dwarf;
287 | ENABLE_STRICT_OBJC_MSGSEND = YES;
288 | ENABLE_TESTABILITY = YES;
289 | GCC_C_LANGUAGE_STANDARD = gnu99;
290 | GCC_DYNAMIC_NO_PIC = NO;
291 | GCC_NO_COMMON_BLOCKS = YES;
292 | GCC_OPTIMIZATION_LEVEL = 0;
293 | GCC_PREPROCESSOR_DEFINITIONS = (
294 | "DEBUG=1",
295 | "$(inherited)",
296 | );
297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
299 | GCC_WARN_UNDECLARED_SELECTOR = YES;
300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
301 | GCC_WARN_UNUSED_FUNCTION = YES;
302 | GCC_WARN_UNUSED_VARIABLE = YES;
303 | MACOSX_DEPLOYMENT_TARGET = 10.11;
304 | MTL_ENABLE_DEBUG_INFO = YES;
305 | ONLY_ACTIVE_ARCH = YES;
306 | SDKROOT = macosx;
307 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
308 | VERSIONING_SYSTEM = "apple-generic";
309 | VERSION_INFO_PREFIX = "";
310 | };
311 | name = Debug;
312 | };
313 | 047C40BE1C1A294700D6B267 /* Release */ = {
314 | isa = XCBuildConfiguration;
315 | buildSettings = {
316 | ALWAYS_SEARCH_USER_PATHS = NO;
317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
318 | CLANG_CXX_LIBRARY = "libc++";
319 | CLANG_ENABLE_MODULES = YES;
320 | CLANG_ENABLE_OBJC_ARC = YES;
321 | CLANG_WARN_BOOL_CONVERSION = YES;
322 | CLANG_WARN_CONSTANT_CONVERSION = YES;
323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
324 | CLANG_WARN_EMPTY_BODY = YES;
325 | CLANG_WARN_ENUM_CONVERSION = YES;
326 | CLANG_WARN_INFINITE_RECURSION = YES;
327 | CLANG_WARN_INT_CONVERSION = YES;
328 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
329 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
330 | CLANG_WARN_UNREACHABLE_CODE = YES;
331 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
332 | CODE_SIGN_IDENTITY = "-";
333 | COPY_PHASE_STRIP = NO;
334 | CURRENT_PROJECT_VERSION = 1;
335 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
336 | ENABLE_NS_ASSERTIONS = NO;
337 | ENABLE_STRICT_OBJC_MSGSEND = YES;
338 | GCC_C_LANGUAGE_STANDARD = gnu99;
339 | GCC_NO_COMMON_BLOCKS = YES;
340 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
341 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
342 | GCC_WARN_UNDECLARED_SELECTOR = YES;
343 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
344 | GCC_WARN_UNUSED_FUNCTION = YES;
345 | GCC_WARN_UNUSED_VARIABLE = YES;
346 | MACOSX_DEPLOYMENT_TARGET = 10.11;
347 | MTL_ENABLE_DEBUG_INFO = NO;
348 | SDKROOT = macosx;
349 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
350 | VERSIONING_SYSTEM = "apple-generic";
351 | VERSION_INFO_PREFIX = "";
352 | };
353 | name = Release;
354 | };
355 | 047C40C01C1A294700D6B267 /* Debug */ = {
356 | isa = XCBuildConfiguration;
357 | buildSettings = {
358 | CLANG_ENABLE_MODULES = YES;
359 | COMBINE_HIDPI_IMAGES = YES;
360 | DEFINES_MODULE = YES;
361 | DYLIB_COMPATIBILITY_VERSION = 1;
362 | DYLIB_CURRENT_VERSION = 1;
363 | DYLIB_INSTALL_NAME_BASE = "@rpath";
364 | FRAMEWORK_VERSION = A;
365 | INFOPLIST_FILE = ScreenCapture/Info.plist;
366 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
368 | PRODUCT_BUNDLE_IDENTIFIER = net.nirix.ScreenCapture;
369 | PRODUCT_NAME = "$(TARGET_NAME)";
370 | SKIP_INSTALL = YES;
371 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
372 | SWIFT_VERSION = 3.0;
373 | };
374 | name = Debug;
375 | };
376 | 047C40C11C1A294700D6B267 /* Release */ = {
377 | isa = XCBuildConfiguration;
378 | buildSettings = {
379 | CLANG_ENABLE_MODULES = YES;
380 | COMBINE_HIDPI_IMAGES = YES;
381 | DEFINES_MODULE = YES;
382 | DYLIB_COMPATIBILITY_VERSION = 1;
383 | DYLIB_CURRENT_VERSION = 1;
384 | DYLIB_INSTALL_NAME_BASE = "@rpath";
385 | FRAMEWORK_VERSION = A;
386 | INFOPLIST_FILE = ScreenCapture/Info.plist;
387 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
388 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
389 | PRODUCT_BUNDLE_IDENTIFIER = net.nirix.ScreenCapture;
390 | PRODUCT_NAME = "$(TARGET_NAME)";
391 | SKIP_INSTALL = YES;
392 | SWIFT_VERSION = 3.0;
393 | };
394 | name = Release;
395 | };
396 | 047C40EC1C1A2AFA00D6B267 /* Debug */ = {
397 | isa = XCBuildConfiguration;
398 | buildSettings = {
399 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
400 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
401 | COMBINE_HIDPI_IMAGES = YES;
402 | INFOPLIST_FILE = Example/Info.plist;
403 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
404 | PRODUCT_BUNDLE_IDENTIFIER = net.nirix.Example;
405 | PRODUCT_NAME = "$(TARGET_NAME)";
406 | SWIFT_VERSION = 3.0;
407 | };
408 | name = Debug;
409 | };
410 | 047C40ED1C1A2AFA00D6B267 /* Release */ = {
411 | isa = XCBuildConfiguration;
412 | buildSettings = {
413 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
415 | COMBINE_HIDPI_IMAGES = YES;
416 | INFOPLIST_FILE = Example/Info.plist;
417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
418 | PRODUCT_BUNDLE_IDENTIFIER = net.nirix.Example;
419 | PRODUCT_NAME = "$(TARGET_NAME)";
420 | SWIFT_VERSION = 3.0;
421 | };
422 | name = Release;
423 | };
424 | /* End XCBuildConfiguration section */
425 |
426 | /* Begin XCConfigurationList section */
427 | 047C40A51C1A294700D6B267 /* Build configuration list for PBXProject "ScreenCapture" */ = {
428 | isa = XCConfigurationList;
429 | buildConfigurations = (
430 | 047C40BD1C1A294700D6B267 /* Debug */,
431 | 047C40BE1C1A294700D6B267 /* Release */,
432 | );
433 | defaultConfigurationIsVisible = 0;
434 | defaultConfigurationName = Release;
435 | };
436 | 047C40BF1C1A294700D6B267 /* Build configuration list for PBXNativeTarget "ScreenCapture" */ = {
437 | isa = XCConfigurationList;
438 | buildConfigurations = (
439 | 047C40C01C1A294700D6B267 /* Debug */,
440 | 047C40C11C1A294700D6B267 /* Release */,
441 | );
442 | defaultConfigurationIsVisible = 0;
443 | defaultConfigurationName = Release;
444 | };
445 | 047C40EB1C1A2AFA00D6B267 /* Build configuration list for PBXNativeTarget "Example" */ = {
446 | isa = XCConfigurationList;
447 | buildConfigurations = (
448 | 047C40EC1C1A2AFA00D6B267 /* Debug */,
449 | 047C40ED1C1A2AFA00D6B267 /* Release */,
450 | );
451 | defaultConfigurationIsVisible = 0;
452 | defaultConfigurationName = Release;
453 | };
454 | /* End XCConfigurationList section */
455 | };
456 | rootObject = 047C40A21C1A294700D6B267 /* Project object */;
457 | }
458 |
--------------------------------------------------------------------------------
/Example/Base.lproj/MainMenu.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
676 |
677 |
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
694 |
695 |
696 |
697 |
698 |
699 |
700 |
711 |
722 |
723 |
724 |
725 |
726 |
727 |
728 |
729 |
730 |
731 |
732 |
733 |
734 |
745 |
756 |
767 |
768 |
769 |
770 |
771 |
772 |
773 |
774 |
775 |
776 |
777 |
778 |
--------------------------------------------------------------------------------