Skip to content

Commit

Permalink
Add spaces after semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCoates committed Sep 23, 2016
1 parent 77a9f78 commit b09f5fc
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 91 deletions.
8 changes: 4 additions & 4 deletions Aerial.xcodeproj/project.pbxproj
Expand Up @@ -48,7 +48,7 @@
/* Begin PBXFileReference section */
FA143CD61BDA3E880041A82B /* Aerial Test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Aerial Test.app"; sourceTree = BUILT_PRODUCTS_DIR; };
FA143CE51BDA3EEF0041A82B /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = System/Library/Frameworks/AVKit.framework; sourceTree = SDKROOT; };
FA36BD3E1BE57F8E00D5E03B /* VideoDownload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoDownload.swift; sourceTree = "<group>"; };
FA36BD3E1BE57F8E00D5E03B /* VideoDownload.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = VideoDownload.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FA6F81DB1D939455007975FE /* Preferences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
FAB22A7D1BE17D7D0065C0F5 /* AssetLoaderDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AssetLoaderDelegate.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FAC36F301BE1756D007F2A20 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppDelegate.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
Expand All @@ -60,16 +60,16 @@
FAC36F391BE1756D007F2A20 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FAC36F3A1BE1756D007F2A20 /* PreferencesWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesWindow.xib; sourceTree = "<group>"; };
FAC36F3B1BE1756D007F2A20 /* thumbnail.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = thumbnail.png; sourceTree = "<group>"; };
FAC36F3E1BE1756D007F2A20 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = "<group>"; };
FAC36F3E1BE1756D007F2A20 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = PreferencesWindowController.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FAC36F401BE1756D007F2A20 /* AerialVideo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AerialVideo.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FAC36F431BE1756D007F2A20 /* AerialView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AerialView.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FAC36F441BE1756D007F2A20 /* CheckCellView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CheckCellView.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FAC36F631BE1772F007F2A20 /* CollectionType+Shuffling.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CollectionType+Shuffling.swift"; sourceTree = "<group>"; };
FAC36F661BE1778C007F2A20 /* ManifestLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ManifestLoader.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FAC36F691BE1780B007F2A20 /* Debug.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Debug.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FACAF1A51BD9FC6000E539DC /* Aerial.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Aerial.saver; sourceTree = BUILT_PRODUCTS_DIR; };
FAF450201BE2B45D00C1F98A /* VideoLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoLoader.swift; sourceTree = "<group>"; };
FAF450231BE2D2FD00C1F98A /* VideoCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoCache.swift; sourceTree = "<group>"; };
FAF450201BE2B45D00C1F98A /* VideoLoader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = VideoLoader.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
FAF450231BE2D2FD00C1F98A /* VideoCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = VideoCache.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down
2 changes: 1 addition & 1 deletion Aerial/App/AppDelegate.swift
Expand Up @@ -26,7 +26,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
setUp(preferencesWindow: preferencesWindow)
}

private func setUp(preferencesWindow window:NSWindow) {
private func setUp(preferencesWindow window: NSWindow) {
window.makeKeyAndOrderFront(self)
window.styleMask = [
NSTitledWindowMask,
Expand Down
22 changes: 11 additions & 11 deletions Aerial/Source/Controllers/PreferencesWindowController.swift
Expand Up @@ -26,11 +26,11 @@ class City {
var day: TimeOfDay = TimeOfDay(title: "day")
let name: String

init(name:String) {
init(name: String) {
self.name = name
}

func addVideoForTimeOfDay(_ timeOfDay:String, video:AerialVideo) {
func addVideoForTimeOfDay(_ timeOfDay: String, video: AerialVideo) {
if timeOfDay.lowercased() == "night" {
video.arrayPosition = night.videos.count
night.videos.append(video)
Expand Down Expand Up @@ -58,7 +58,7 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,
// cities -> time of day -> videos
var cities = [City]()

static var loadedJSON:Bool = false
static var loadedJSON: Bool = false

lazy var preferences = Preferences.sharedInstance

Expand Down Expand Up @@ -122,14 +122,14 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,

// MARK: - Preferences

@IBAction func cacheAerialsAsTheyPlayClick(_ button:NSButton!) {
@IBAction func cacheAerialsAsTheyPlayClick(_ button: NSButton!) {
debugLog("cache aerials as they play: \(button.state)")

let onState = (button.state == NSOnState)
preferences.cacheAerials = onState
}

@IBAction func userSetCacheLocation(_ button:NSButton?) {
@IBAction func userSetCacheLocation(_ button: NSButton?) {
let openPanel = NSOpenPanel()

openPanel.canChooseDirectories = true
Expand All @@ -151,7 +151,7 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,
self.cacheLocation.url = cacheDirectory
}
}
@IBAction func resetCacheLocation(_ button:NSButton?) {
@IBAction func resetCacheLocation(_ button: NSButton?) {
preferences.customCacheDirectory = nil
if let cacheDirectory = VideoCache.cacheDirectory {
cacheLocation.url = URL(fileURLWithPath: cacheDirectory as String)
Expand Down Expand Up @@ -197,7 +197,7 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,
outlineView.reloadData()
}

@IBAction func differentAerialsOnEachDisplayCheckClick(_ button:NSButton?) {
@IBAction func differentAerialsOnEachDisplayCheckClick(_ button: NSButton?) {
let state = differentAerialCheckbox.state
let onState = (state == NSOnState)

Expand All @@ -208,7 +208,7 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,

// MARK: - Link

@IBAction func pageProjectClick(_ button:NSButton?) {
@IBAction func pageProjectClick(_ button: NSButton?) {
let workspace = NSWorkspace.shared()
let url = URL(string: "http://github.com/JohnCoates/Aerial")!
workspace.open(url)
Expand Down Expand Up @@ -479,7 +479,7 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,
cacheStatusLabel.stringValue = "Loading JSON"
currentProgress.maxValue = 1

ManifestLoader.instance.addCallback { (manifestVideos:[AerialVideo]) -> Void in
ManifestLoader.instance.addCallback { (manifestVideos: [AerialVideo]) -> Void in
DispatchQueue.main.async(execute: { () -> Void in
self.manifestVideos = manifestVideos
self.cacheNextVideo()
Expand Down Expand Up @@ -525,7 +525,7 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,
// MARK: - Video Download Delegate

func videoDownload(_ videoDownload: VideoDownload,
finished success: Bool, errorMessage:String?) {
finished success: Bool, errorMessage: String?) {
if let message = errorMessage {
cacheStatusLabel.stringValue = message
} else {
Expand All @@ -535,7 +535,7 @@ class PreferencesWindowController: NSWindowController, NSOutlineViewDataSource,
NSLog("video download finished with success: \(success))")
}

func videoDownload(_ videoDownload:VideoDownload, receivedBytes:Int, progress:Float) {
func videoDownload(_ videoDownload: VideoDownload, receivedBytes: Int, progress: Float) {
currentProgress.doubleValue = Double(progress)
// NSLog("received bytes: \(receivedBytes), progress: \(progress)")
}
Expand Down
2 changes: 1 addition & 1 deletion Aerial/Source/Models/AerialVideo.swift
Expand Up @@ -32,6 +32,6 @@ class AerialVideo {
self.name = name
self.type = type
self.timeOfDay = timeOfDay
self.url = URL(string:url)!
self.url = URL(string: url)!
}
}
18 changes: 9 additions & 9 deletions Aerial/Source/Models/Cache/AssetLoaderDelegate.swift
Expand Up @@ -11,7 +11,7 @@ import AVFoundation

/// Returns an AVURLAsset that is automatically cached. If already cached
/// then returns the cached asset.
func CachedOrCachingAsset(_ URL:Foundation.URL) -> AVURLAsset {
func CachedOrCachingAsset(_ URL: Foundation.URL) -> AVURLAsset {
let assetLoader = AssetLoaderDelegate(URL: URL)

let asset = AVURLAsset(url: assetLoader.URLWithCustomScheme)
Expand All @@ -25,17 +25,17 @@ func CachedOrCachingAsset(_ URL:Foundation.URL) -> AVURLAsset {

class AssetLoaderDelegate : NSObject, AVAssetResourceLoaderDelegate, VideoLoaderDelegate {

let URL:Foundation.URL
var videoLoaders:[VideoLoader] = []
let videoCache:VideoCache
let URL: Foundation.URL
var videoLoaders: [VideoLoader] = []
let videoCache: VideoCache

var URLWithCustomScheme:Foundation.URL {
var URLWithCustomScheme: Foundation.URL {
var components = URLComponents(url: URL, resolvingAgainstBaseURL: false)!
components.scheme = "streaming"
return components.url!
}

init(URL:Foundation.URL) {
init(URL: Foundation.URL) {
self.URL = URL
// self.URL = NSURL(string:"http://localhost/test.mov")!
videoCache = VideoCache(URL: URL)
Expand All @@ -47,19 +47,19 @@ class AssetLoaderDelegate : NSObject, AVAssetResourceLoaderDelegate, VideoLoader

// MARK: - Video Loader Delegate

func videoLoader(_ videoLoader:VideoLoader, receivedResponse response:URLResponse) {
func videoLoader(_ videoLoader: VideoLoader, receivedResponse response: URLResponse) {
videoCache.receivedContentLength(Int(response.expectedContentLength))
}

func videoLoader(_ videoLoader:VideoLoader, receivedData data:Data, forRange range:NSRange) {
func videoLoader(_ videoLoader: VideoLoader, receivedData data: Data, forRange range: NSRange) {
videoCache.receivedData(data, atRange: range)
}

// MARK: - Asset Resource Loader Delegate
func resourceLoader(_ resourceLoader: AVAssetResourceLoader, didCancel loadingRequest: AVAssetResourceLoadingRequest) {
// debugLog("cancelled load request: \(loadingRequest)")

var remove:VideoLoader?
var remove: VideoLoader?
for loader in videoLoaders {
if loader.loadingRequest != loadingRequest {
continue
Expand Down
24 changes: 12 additions & 12 deletions Aerial/Source/Models/Cache/VideoCache.swift
Expand Up @@ -59,7 +59,7 @@ class VideoCache {
}
}

static func isAvailableOffline(video:AerialVideo) -> Bool {
static func isAvailableOffline(video: AerialVideo) -> Bool {
guard let videoCachePath = cachePath(forVideo: video) else {
NSLog("Aerial Error: Couldn't get video cache path!")
return false
Expand All @@ -86,7 +86,7 @@ class VideoCache {
return videoCachePath
}

init(URL:Foundation.URL) {
init(URL: Foundation.URL) {
videoData = Data()
loading = true
self.URL = URL
Expand All @@ -95,7 +95,7 @@ class VideoCache {

// MARK: - Data Adding

func receivedContentLength(_ contentLength:Int) {
func receivedContentLength(_ contentLength: Int) {
if loading == false {
return
}
Expand All @@ -108,7 +108,7 @@ class VideoCache {
videoData = mutableVideoData! as Data
}

func receivedData(_ data:Data, atRange range:NSRange) {
func receivedData(_ data: Data, atRange range: NSRange) {
guard let mutableVideoData = mutableVideoData else {
NSLog("Aerial Error: Received data without having mutable video data")
return
Expand Down Expand Up @@ -197,7 +197,7 @@ class VideoCache {

// MARK: - Fulfilling cache

func fulfillLoadingRequest(_ loadingRequest:AVAssetResourceLoadingRequest) -> Bool {
func fulfillLoadingRequest(_ loadingRequest: AVAssetResourceLoadingRequest) -> Bool {
guard let dataRequest = loadingRequest.dataRequest else {
NSLog("Aerial Error: Missing data request for \(loadingRequest)")
return false
Expand All @@ -218,13 +218,13 @@ class VideoCache {
return true
}

func fillInContentInformation(_ loadingRequest:AVAssetResourceLoadingRequest) {
func fillInContentInformation(_ loadingRequest: AVAssetResourceLoadingRequest) {

guard let contentInformationRequest = loadingRequest.contentInformationRequest else {
return
}

let contentType:String = kUTTypeQuickTimeMovie as String
let contentType: String = kUTTypeQuickTimeMovie as String

contentInformationRequest.isByteRangeAccessSupported = true
contentInformationRequest.contentType = contentType
Expand All @@ -234,7 +234,7 @@ class VideoCache {
// MARK: - Cache Checking

// Whether the video cache can fulfill this request
func canFulfillLoadingRequest(_ loadingRequest:AVAssetResourceLoadingRequest) -> Bool {
func canFulfillLoadingRequest(_ loadingRequest: AVAssetResourceLoadingRequest) -> Bool {

if (loading == false) {
return true
Expand Down Expand Up @@ -265,14 +265,14 @@ class VideoCache {
// MARK: - Consolidating

func consolidateLoadedRanges() {
var consolidatedRanges:[NSRange] = []
var consolidatedRanges: [NSRange] = []

let sortedRanges = loadedRanges.sorted { $0.location < $1.location }

var previousRange:NSRange?
var lastIndex:Int?
var previousRange: NSRange?
var lastIndex: Int?
for range in sortedRanges {
if let lastRange:NSRange = previousRange {
if let lastRange: NSRange = previousRange {
let lastRangeEndOffset = lastRange.location + lastRange.length

// check if range can be consumed by lastRange
Expand Down

0 comments on commit b09f5fc

Please sign in to comment.