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 ContentDescription: Decodable, CustomStringConvertible { | |
var description: String { | |
let nA = "N/A" | |
let english = self.english ?? nA | |
let thai = self.thai ?? nA | |
let malaysian = self.malaysian ?? nA | |
let vietnamese = self.vietnamese ?? nA | |
return "English: \(english) Thai: \(thai) Malaysian: \(malaysian) Vietnamese: \(vietnamese)" | |
} | |
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 TVShow: BaseContent, Equatable { | |
var parentId: Int? | |
enum TVShowCodingKeys: String, CodingKey { | |
case parentId = "parentId" | |
} | |
required init(from decoder: Decoder) throws { | |
let container = try decoder.container(keyedBy: TVShowCodingKeys.self) | |
parentId = try container.decodeIfPresent(Int.self, forKey: .parentId) |
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 Foundation | |
class Movie: BaseContent, Equatable { | |
var playURL: String? | |
var contentStartOffset: Int? | |
var contentEndOffset: Int? | |
enum MovieCodingKeys: String, CodingKey { | |
case playURL = "playURL" | |
case contentStartOffset = "contentStartOffset" |
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 BaseContent: Decodable { | |
var id: Int? | |
var vimondID: Int? | |
var imageUrl: String? | |
var title: ContentDescription? | |
var description: ContentDescription? | |
var synopsis: ContentDescription? | |
var trailers: [String]? | |
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
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSExceptionDomains</key> | |
<dict> | |
<key>watsonplatform.net</key> | |
<dict> | |
<key>NSTemporaryExceptionRequiresForwardSecrecy</key> | |
<false/> | |
<key>NSIncludesSubdomains</key> | |
<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
git reset --hard <commit_id> && git clean -f | |
git push origin master -f |
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
private func queryLambdaFunction() { | |
let params = [ | |
"car1": "corola", | |
"car2": "camery" | |
] | |
Alamofire.request(.GET, "https://lgr2oati9b.execute-api.us-east-1.amazonaws.com/prod/carcomparison",parameters: params).response { (request, response, data, error) in | |
print(NSString(data: data!, encoding: NSUTF8StringEncoding)) | |
do { | |
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 imageInsights() { | |
let params = ["api_key": "d1a562a2f9cc209934068cbb573c29386ef112f3", | |
"url": "http://www.windowsmode.com/wp-content/uploads/2015/08/Puppy-Eye-Beagle.jpg", | |
"version": "2016-05-19"] | |
Alamofire.request(.GET, "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify", parameters: params).response { (request, response, data, error) in | |
do { | |
let serverData = try NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments) as? [String: AnyObject] | |
if let data = serverData { |
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 imageInsights() { | |
Alamofire.request(.GET, "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/classify?" + | |
"api_key=d1a562a2f9cc209934068cbb573c29386ef112f3&" + | |
"url=http://www.windowsmode.com/wp-content/uploads/2015/08/Puppy-Eye-Beagle.jpg" + | |
"&version=2016-05-19").response { (request, response, data, error) in | |
do { | |
let serverData = try NSJSONSerialization.JSONObjectWithData(data!, options: .AllowFragments) as? [String: AnyObject] | |
if let data = serverData { | |
print(data) | |
} |
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
// | |
// Event.swift | |
// OnTheHouse | |
// | |
// Created by Mitul Manish on 16/08/2016. | |
// Copyright © 2016 Mitul Manish. All rights reserved. | |
// | |
import Foundation |