forked from insidegui/WWDC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved transcript indexing to an XPC service
- Loading branch information
Showing
9 changed files
with
458 additions
and
68 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>TranscriptIndexingService</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>NSAppTransportSecurity</key> | ||
<dict> | ||
<key>NSAllowsArbitraryLoads</key> | ||
<true/> | ||
</dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>XPC!</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>NSHumanReadableCopyright</key> | ||
<string>Copyright © 2017 Guilherme Rambo. All rights reserved.</string> | ||
<key>XPCService</key> | ||
<dict> | ||
<key>ServiceType</key> | ||
<string>Application</string> | ||
</dict> | ||
</dict> | ||
</plist> |
4 changes: 4 additions & 0 deletions
4
TranscriptIndexingService/TranscriptIndexingService-Bridging-Header.h
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// | ||
// Use this file to import your target's public headers that you would like to expose to Swift. | ||
// | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// TranscriptIndexingService.swift | ||
// WWDC | ||
// | ||
// Created by Guilherme Rambo on 28/05/17. | ||
// Copyright © 2017 Guilherme Rambo. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import ConfCore | ||
import RealmSwift | ||
|
||
final class TranscriptIndexingService: NSObject, TranscriptIndexingServiceProtocol { | ||
|
||
private var transcriptIndexer: TranscriptIndexer! | ||
|
||
func indexTranscriptsIfNeeded(storageURL: URL, schemaVersion: UInt64) { | ||
if transcriptIndexer == nil { | ||
do { | ||
let config = Realm.Configuration(fileURL: storageURL, schemaVersion: schemaVersion) | ||
let storage = try Storage(config) | ||
transcriptIndexer = TranscriptIndexer(storage) | ||
} catch { | ||
NSLog("[TranscriptIndexingService] Error initializing: \(error)") | ||
return | ||
} | ||
} | ||
|
||
transcriptIndexer.downloadTranscriptsIfNeeded() | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
TranscriptIndexingService/TranscriptIndexingServiceProtocol.swift
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// TranscriptIndexingServiceProtocol.swift | ||
// WWDC | ||
// | ||
// Created by Guilherme Rambo on 28/05/17. | ||
// Copyright © 2017 Guilherme Rambo. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
@objc protocol TranscriptIndexingServiceProtocol: NSObjectProtocol { | ||
|
||
func indexTranscriptsIfNeeded(storageURL: URL, schemaVersion: UInt64) | ||
|
||
} |
Oops, something went wrong.