Skip to content

Commit 3b5e350

Browse files
author
Cesar Vargas Casaseca
committed
Initial project commit
1 parent d655d1b commit 3b5e350

File tree

13 files changed

+1135
-0
lines changed

13 files changed

+1135
-0
lines changed

Wyler/SampleApp/AppDelegate.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// AppDelegate.swift
3+
// SampleApp
4+
//
5+
// Created by Cesar Vargas on 10.04.20.
6+
// Copyright © 2020 Cesar Vargas. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
var window: UIWindow?
14+
15+
func application(_ application: UIApplication,
16+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17+
return true
18+
}
19+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"scale" : "2x",
6+
"size" : "20x20"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"scale" : "3x",
11+
"size" : "20x20"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"scale" : "2x",
16+
"size" : "29x29"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"scale" : "3x",
21+
"size" : "29x29"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"scale" : "2x",
26+
"size" : "40x40"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"scale" : "3x",
31+
"size" : "40x40"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"scale" : "2x",
36+
"size" : "60x60"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"scale" : "3x",
41+
"size" : "60x60"
42+
},
43+
{
44+
"idiom" : "ipad",
45+
"scale" : "1x",
46+
"size" : "20x20"
47+
},
48+
{
49+
"idiom" : "ipad",
50+
"scale" : "2x",
51+
"size" : "20x20"
52+
},
53+
{
54+
"idiom" : "ipad",
55+
"scale" : "1x",
56+
"size" : "29x29"
57+
},
58+
{
59+
"idiom" : "ipad",
60+
"scale" : "2x",
61+
"size" : "29x29"
62+
},
63+
{
64+
"idiom" : "ipad",
65+
"scale" : "1x",
66+
"size" : "40x40"
67+
},
68+
{
69+
"idiom" : "ipad",
70+
"scale" : "2x",
71+
"size" : "40x40"
72+
},
73+
{
74+
"idiom" : "ipad",
75+
"scale" : "1x",
76+
"size" : "76x76"
77+
},
78+
{
79+
"idiom" : "ipad",
80+
"scale" : "2x",
81+
"size" : "76x76"
82+
},
83+
{
84+
"idiom" : "ipad",
85+
"scale" : "2x",
86+
"size" : "83.5x83.5"
87+
},
88+
{
89+
"idiom" : "ios-marketing",
90+
"scale" : "1x",
91+
"size" : "1024x1024"
92+
}
93+
],
94+
"info" : {
95+
"author" : "xcode",
96+
"version" : 1
97+
}
98+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
6+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--View Controller-->
10+
<scene sceneID="EHf-IW-A2E">
11+
<objects>
12+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
13+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
14+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16+
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
17+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18+
</view>
19+
</viewController>
20+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
21+
</objects>
22+
<point key="canvasLocation" x="53" y="375"/>
23+
</scene>
24+
</scenes>
25+
</document>

Wyler/SampleApp/Info.plist

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
<key>LSRequiresIPhoneOS</key>
22+
<true/>
23+
<key>NSPhotoLibraryUsageDescription</key>
24+
<string>Save Sample Video to Camera Roll</string>
25+
<key>UILaunchStoryboardName</key>
26+
<string>LaunchScreen</string>
27+
<key>UIMainStoryboardFile~iphone</key>
28+
<string>Main</string>
29+
<key>UIRequiredDeviceCapabilities</key>
30+
<array>
31+
<string>armv7</string>
32+
</array>
33+
<key>UISupportedInterfaceOrientations</key>
34+
<array>
35+
<string>UIInterfaceOrientationPortrait</string>
36+
<string>UIInterfaceOrientationLandscapeLeft</string>
37+
<string>UIInterfaceOrientationLandscapeRight</string>
38+
</array>
39+
<key>UISupportedInterfaceOrientations~ipad</key>
40+
<array>
41+
<string>UIInterfaceOrientationPortrait</string>
42+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
43+
<string>UIInterfaceOrientationLandscapeLeft</string>
44+
<string>UIInterfaceOrientationLandscapeRight</string>
45+
</array>
46+
</dict>
47+
</plist>

Wyler/SampleApp/Main.storyboard

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16086"/>
6+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
7+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
8+
</dependencies>
9+
<scenes>
10+
<!--View Controller-->
11+
<scene sceneID="tne-QT-ifu">
12+
<objects>
13+
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="SampleApp" customModuleProvider="target" sceneMemberID="viewController">
14+
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
15+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
16+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17+
<subviews>
18+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ocV-fu-pbY" userLabel="Ball">
19+
<rect key="frame" x="137.5" y="283.5" width="100" height="100"/>
20+
<color key="backgroundColor" systemColor="systemRedColor" red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
21+
<constraints>
22+
<constraint firstAttribute="width" constant="100" id="wid-gZ-g8b"/>
23+
<constraint firstAttribute="height" constant="100" id="ygy-Vo-r7S"/>
24+
</constraints>
25+
</view>
26+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uDo-iR-BPQ">
27+
<rect key="frame" x="16" y="60" width="343" height="30"/>
28+
<state key="normal" title="Start Recording"/>
29+
<connections>
30+
<action selector="startRecordingButtonWasPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="uvr-V9-6le"/>
31+
</connections>
32+
</button>
33+
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LVo-vQ-Ima">
34+
<rect key="frame" x="16" y="104" width="343" height="30"/>
35+
<state key="normal" title="Stop Recording"/>
36+
<connections>
37+
<action selector="stopRecordingButtonWasPressed:" destination="BYZ-38-t0r" eventType="touchUpInside" id="Jnh-Vq-VFg"/>
38+
</connections>
39+
</button>
40+
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PgM-Qq-byK">
41+
<rect key="frame" x="310" y="142" width="51" height="31"/>
42+
</switch>
43+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Save To Camera Roll" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2sr-FT-l3J">
44+
<rect key="frame" x="16" y="147" width="286" height="21"/>
45+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
46+
<nil key="textColor"/>
47+
<nil key="highlightedColor"/>
48+
</label>
49+
</subviews>
50+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
51+
<constraints>
52+
<constraint firstItem="LVo-vQ-Ima" firstAttribute="width" secondItem="uDo-iR-BPQ" secondAttribute="width" id="5VQ-kT-uDa"/>
53+
<constraint firstItem="ocV-fu-pbY" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="GKT-tW-2QX"/>
54+
<constraint firstItem="2sr-FT-l3J" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="16" id="UPc-tp-Oom"/>
55+
<constraint firstItem="LVo-vQ-Ima" firstAttribute="trailing" secondItem="uDo-iR-BPQ" secondAttribute="trailing" id="c1L-K9-dti"/>
56+
<constraint firstItem="uDo-iR-BPQ" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" constant="16" id="d7p-9t-Nq5"/>
57+
<constraint firstItem="LVo-vQ-Ima" firstAttribute="leading" secondItem="uDo-iR-BPQ" secondAttribute="leading" id="gZK-Vx-gKp"/>
58+
<constraint firstItem="PgM-Qq-byK" firstAttribute="centerY" secondItem="2sr-FT-l3J" secondAttribute="centerY" id="jQb-ax-rxS"/>
59+
<constraint firstItem="ocV-fu-pbY" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="kUZ-sg-rMp"/>
60+
<constraint firstItem="LVo-vQ-Ima" firstAttribute="height" secondItem="uDo-iR-BPQ" secondAttribute="height" id="mZI-LG-rSx"/>
61+
<constraint firstItem="LVo-vQ-Ima" firstAttribute="top" secondItem="uDo-iR-BPQ" secondAttribute="bottom" constant="14" id="myE-ab-Hf9"/>
62+
<constraint firstItem="uDo-iR-BPQ" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" constant="60" id="paf-yI-Iyn"/>
63+
<constraint firstItem="2sr-FT-l3J" firstAttribute="top" secondItem="LVo-vQ-Ima" secondAttribute="bottom" constant="13" id="t6h-bt-iVz"/>
64+
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="PgM-Qq-byK" secondAttribute="trailing" constant="16" id="tuo-wM-cSP"/>
65+
<constraint firstItem="PgM-Qq-byK" firstAttribute="leading" secondItem="2sr-FT-l3J" secondAttribute="trailing" constant="8" id="ubl-5x-hQA"/>
66+
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="uDo-iR-BPQ" secondAttribute="trailing" constant="16" id="y7h-ee-AaE"/>
67+
</constraints>
68+
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
69+
</view>
70+
<connections>
71+
<outlet property="bouncingBall" destination="ocV-fu-pbY" id="hJM-VY-fuO"/>
72+
<outlet property="cameraRollLabel" destination="2sr-FT-l3J" id="Y2i-Vn-K3I"/>
73+
<outlet property="cameraRollSwitch" destination="PgM-Qq-byK" id="ALM-9R-s7x"/>
74+
<outlet property="startRecordingButton" destination="uDo-iR-BPQ" id="8lG-lj-1kv"/>
75+
<outlet property="stopRecordingButton" destination="LVo-vQ-Ima" id="jcu-7m-tfb"/>
76+
</connections>
77+
</viewController>
78+
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
79+
</objects>
80+
<point key="canvasLocation" x="136.80000000000001" y="133.5832083958021"/>
81+
</scene>
82+
<!--Image View Controller-->
83+
<scene sceneID="LK3-rQ-3xG">
84+
<objects>
85+
<viewController storyboardIdentifier="ImageViewController" id="8wH-8l-QD4" customClass="ImageViewController" customModule="SampleApp" customModuleProvider="target" sceneMemberID="viewController">
86+
<view key="view" contentMode="scaleToFill" id="eeA-fg-7NM">
87+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
88+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
89+
<subviews>
90+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="e3H-Tz-S4A">
91+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
92+
<color key="backgroundColor" systemColor="systemGreenColor" red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
93+
</imageView>
94+
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3eF-Jl-gH5" userLabel="New Image View">
95+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
96+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
97+
</imageView>
98+
</subviews>
99+
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
100+
<constraints>
101+
<constraint firstItem="e3H-Tz-S4A" firstAttribute="centerX" secondItem="dSa-tL-MSr" secondAttribute="centerX" id="0AD-Ov-JO2"/>
102+
<constraint firstItem="e3H-Tz-S4A" firstAttribute="height" secondItem="eeA-fg-7NM" secondAttribute="height" id="5QI-iw-F3S"/>
103+
<constraint firstItem="e3H-Tz-S4A" firstAttribute="width" secondItem="eeA-fg-7NM" secondAttribute="width" id="6B7-IZ-VFG"/>
104+
<constraint firstItem="e3H-Tz-S4A" firstAttribute="centerY" secondItem="dSa-tL-MSr" secondAttribute="centerY" id="7hf-Gw-SBh"/>
105+
<constraint firstItem="3eF-Jl-gH5" firstAttribute="centerY" secondItem="e3H-Tz-S4A" secondAttribute="centerY" id="HyS-Ga-EbM"/>
106+
<constraint firstItem="3eF-Jl-gH5" firstAttribute="width" secondItem="e3H-Tz-S4A" secondAttribute="width" id="SCt-ve-ue0"/>
107+
<constraint firstItem="3eF-Jl-gH5" firstAttribute="centerX" secondItem="e3H-Tz-S4A" secondAttribute="centerX" id="hvG-NJ-7aj"/>
108+
<constraint firstItem="3eF-Jl-gH5" firstAttribute="height" secondItem="e3H-Tz-S4A" secondAttribute="height" id="zbD-nb-Oct"/>
109+
</constraints>
110+
<viewLayoutGuide key="safeArea" id="dSa-tL-MSr"/>
111+
</view>
112+
<connections>
113+
<outlet property="imageView" destination="e3H-Tz-S4A" id="nfs-Lv-36I"/>
114+
<outlet property="newImageView" destination="3eF-Jl-gH5" id="u83-QH-8fI"/>
115+
</connections>
116+
</viewController>
117+
<placeholder placeholderIdentifier="IBFirstResponder" id="g7J-1R-J4L" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
118+
</objects>
119+
<point key="canvasLocation" x="888.79999999999995" y="133.5832083958021"/>
120+
</scene>
121+
</scenes>
122+
</document>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//
2+
// ViewController.swift
3+
// SampleApp
4+
//
5+
// Created by Cesar Vargas on 12.04.20.
6+
// Copyright © 2020 Cesar Vargas. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import UIKit
11+
import QuartzCore
12+
import Wyler
13+
14+
final class ViewController: UIViewController {
15+
@IBOutlet weak var bouncingBall: UIView!
16+
@IBOutlet weak var startRecordingButton: UIButton!
17+
@IBOutlet weak var stopRecordingButton: UIButton!
18+
@IBOutlet weak var cameraRollSwitch: UISwitch!
19+
@IBOutlet weak var cameraRollLabel: UILabel!
20+
21+
private let screenRecorder = ScreenRecorder()
22+
23+
override func viewDidLoad() {
24+
super.viewDidLoad()
25+
26+
bouncingBall.layer.cornerRadius = bouncingBall.frame.width / 2
27+
}
28+
29+
@IBAction func stopRecordingButtonWasPressed(_ sender: Any) {
30+
enableElements(isRecording: false)
31+
32+
bouncingBall.layer.removeAllAnimations()
33+
self.bouncingBall.alpha = 1
34+
35+
screenRecorder.stoprecording(errorHandler: { error in
36+
debugPrint("Error when stop recording \(error)")
37+
})
38+
}
39+
40+
@IBAction func startRecordingButtonWasPressed(_ sender: Any) {
41+
enableElements(isRecording: true)
42+
43+
animateBall()
44+
45+
screenRecorder.startRecording(saveToCameraRoll: cameraRollSwitch.isOn, error: { error in
46+
debugPrint("Error when recording \(error)")
47+
})
48+
}
49+
50+
private func enableElements(isRecording: Bool) {
51+
startRecordingButton.isEnabled = !isRecording
52+
stopRecordingButton.isEnabled = isRecording
53+
cameraRollSwitch.isEnabled = !isRecording
54+
cameraRollLabel.isEnabled = !isRecording
55+
}
56+
57+
private func animateBall() {
58+
UIView.animate(withDuration: 2,
59+
delay: 1,
60+
usingSpringWithDamping: 0.5,
61+
initialSpringVelocity: 5,
62+
options: [.curveEaseInOut, .repeat, .autoreverse], animations: {
63+
self.bouncingBall.alpha = 0.25
64+
}, completion: { _ in })
65+
}
66+
}

0 commit comments

Comments
 (0)