pod cache clean --all
rm -rf ~/Library/Caches/Cocoapods
pod deintegrate
pod setup
pod install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol OptionalType { | |
associatedtype Wrapped | |
var value: Wrapped? { get } | |
} | |
extension Optional: OptionalType { | |
public var value: Wrapped? { | |
return self | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func duration(_ executable: () -> Void) -> TimeInterval { | |
let startTime = Date() | |
executable() | |
return abs(startTime.timeIntervalSinceNow) | |
} | |
func measure(_ executable: () -> Void) { | |
let startTime = Date() | |
executable() | |
let endTime = Date() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RecordViewController: UIViewController { | |
// MARK: - Properties | |
... | |
// 9. 녹화가 시작되면 status bar를 감춥니다. | |
override var prefersStatusBarHidden: Bool { | |
return (self.navigationController?.isNavigationBarHidden)! | |
} | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension RecordViewController: RPPreviewViewControllerDelegate { | |
func previewControllerDidFinish(_ previewController: RPPreviewViewController) { | |
// 8. PreviewViewController에서 작업이 끝나면 화면을 MasterViewController로 이동합니다. | |
previewController.dismiss(animated: true) { | |
let _ = self.navigationController?.popViewController(animated: true) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func stopRecording() { | |
let recorder = RPScreenRecorder.shared() | |
if isRecording { | |
// 7-1. 사용자가 녹화 중간에 녹음을 종료하는 경우 | |
Log.warning?.message("Stop recording unexpectedly") | |
recorder.stopRecording(handler: { (previewController, recordingError) in | |
if let error = recordingError { | |
Log.error?.message(error.localizedDescription) | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RecordViewController: UIViewController { | |
// MARK: - Properties | |
var timer = Timer? | |
var currentLocation: Int = 0 | |
... | |
func startAnimatingMap() { | |
if currentLocation == 0 { | |
showLocationOnMap(index: currentLocation) | |
currentLocation += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ReplayKit | |
class RecordViewController: UIViewController { | |
// MARK: - Properties | |
... | |
// 0. 현재 녹화 여부를 확인합니다. | |
var isRecording: Bool = false | |
... | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func barButtonAction(_ sender: UIBarButtonItem) { | |
if sender.title == "Start Recording" { | |
... | |
startRecording() | |
} else if sender.title == "Stop Recording" { | |
... | |
stopRecording() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBOutlet weak var barButton: UIBarButtonItem! | |
@IBAction func barButtonAction(_ sender: UIBarButtonItem) { | |
if sender.title == "Start Recording" { | |
Log.info?.message("Start Recording!") | |
sender.title = "Stop Recording" | |
} else if sender.title == "Stop Recording" { | |
Log.info?.message("Stop Recording!") | |
sender.title = "Start Recording" | |
} |