VEX-5682: iOS Swift Conversion (#11)
Converts ios implementation from objective-c to swift.
This commit is contained in:
30
ios/Video/DataStructures/DRMParams.swift
Normal file
30
ios/Video/DataStructures/DRMParams.swift
Normal file
@@ -0,0 +1,30 @@
|
||||
struct DRMParams {
|
||||
let type: String?
|
||||
let licenseServer: String?
|
||||
let headers: Dictionary<String,Any>?
|
||||
let contentId: String?
|
||||
let certificateUrl: String?
|
||||
let base64Certificate: Bool?
|
||||
|
||||
let json: NSDictionary?
|
||||
|
||||
init(_ json: NSDictionary!) {
|
||||
guard json != nil else {
|
||||
self.json = nil
|
||||
self.type = nil
|
||||
self.licenseServer = nil
|
||||
self.contentId = nil
|
||||
self.certificateUrl = nil
|
||||
self.base64Certificate = nil
|
||||
self.headers = nil
|
||||
return
|
||||
}
|
||||
self.json = json
|
||||
self.type = json["type"] as? String
|
||||
self.licenseServer = json["licenseServer"] as? String
|
||||
self.contentId = json["contentId"] as? String
|
||||
self.certificateUrl = json["certificateUrl"] as? String
|
||||
self.base64Certificate = json["base64Certificate"] as? Bool
|
||||
self.headers = json["headers"] as? Dictionary<String,Any>
|
||||
}
|
||||
}
|
18
ios/Video/DataStructures/SelectedTrackCriteria.swift
Normal file
18
ios/Video/DataStructures/SelectedTrackCriteria.swift
Normal file
@@ -0,0 +1,18 @@
|
||||
struct SelectedTrackCriteria {
|
||||
let type: String
|
||||
let value: Any?
|
||||
|
||||
let json: NSDictionary?
|
||||
|
||||
init(_ json: NSDictionary!) {
|
||||
guard json != nil else {
|
||||
self.json = nil
|
||||
self.type = ""
|
||||
self.value = nil
|
||||
return
|
||||
}
|
||||
self.json = json
|
||||
self.type = json["type"] as? String ?? ""
|
||||
self.value = json["value"]
|
||||
}
|
||||
}
|
25
ios/Video/DataStructures/TextTrack.swift
Normal file
25
ios/Video/DataStructures/TextTrack.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
struct TextTrack {
|
||||
let type: String
|
||||
let language: String
|
||||
let title: String
|
||||
let uri: String
|
||||
|
||||
let json: NSDictionary?
|
||||
|
||||
init(_ json: NSDictionary!) {
|
||||
guard json != nil else {
|
||||
self.json = nil
|
||||
self.type = ""
|
||||
self.language = ""
|
||||
self.title = ""
|
||||
self.uri = ""
|
||||
return
|
||||
}
|
||||
self.json = json
|
||||
self.type = json["type"] as? String ?? ""
|
||||
self.language = json["language"] as? String ?? ""
|
||||
self.title = json["title"] as? String ?? ""
|
||||
self.uri = json["uri"] as? String ?? ""
|
||||
}
|
||||
}
|
31
ios/Video/DataStructures/VideoSource.swift
Normal file
31
ios/Video/DataStructures/VideoSource.swift
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
struct VideoSource {
|
||||
let type: String?
|
||||
let uri: String?
|
||||
let isNetwork: Bool
|
||||
let isAsset: Bool
|
||||
let shouldCache: Bool
|
||||
let requestHeaders: Dictionary<String,Any>?
|
||||
|
||||
let json: NSDictionary?
|
||||
|
||||
init(_ json: NSDictionary!) {
|
||||
guard json != nil else {
|
||||
self.json = nil
|
||||
self.type = nil
|
||||
self.uri = nil
|
||||
self.isNetwork = false
|
||||
self.isAsset = false
|
||||
self.shouldCache = false
|
||||
self.requestHeaders = nil
|
||||
return
|
||||
}
|
||||
self.json = json
|
||||
self.type = json["type"] as? String
|
||||
self.uri = json["uri"] as? String
|
||||
self.isNetwork = json["isNetwork"] as? Bool ?? false
|
||||
self.isAsset = json["isAsset"] as? Bool ?? false
|
||||
self.shouldCache = json["shouldCache"] as? Bool ?? false
|
||||
self.requestHeaders = json["requestHeaders"] as? Dictionary<String,Any>
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user