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
"com.test.yourapp": [ | |
{ | |
"domain" : "api.testexample.com", | |
"effectiveUserId" : 102, | |
"domainType" : 2, | |
"timestamp" : "2021-06-08T17:56:22Z", | |
"hasApp.bundleName" : "com.test.yourapp", | |
"context" : "", | |
"hits" : 12, | |
"domainOwner" : "", |
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
{ | |
"stream": "com.apple.privacy.accounting.stream.tcc", | |
"accessor": { | |
"identifier": "com.test.yourapp", | |
"identifierType": "bundleID" | |
}, | |
"tccService": "kTCCServicePhotos", | |
"identifier": "5c737ca6-a4c7–458e-b978–8452950c4be9", | |
"kind": "event", | |
"timestamp": "2021-06-08T17:56:22.434-08:00", |
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
enum Month { | |
case January | |
case February | |
case March | |
case April | |
case May | |
case June | |
case July | |
case August | |
case September |
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
func season(for month: Month) -> String { | |
switch month { | |
case Month.December, Month.January, Month.February: | |
return "Winter" | |
case Month.March, Month.April, Month.May: | |
return "Spring" | |
case Month.June, Month.July, Month.August: | |
return "Summer" | |
case Month.September, Month.October, Month.November: | |
return "Autumn" |
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
enum Month { | |
case January | |
case February | |
case March | |
case April | |
case May | |
case June | |
case July | |
case August | |
case September |
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
let months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] |
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
func season(for month: String) -> String { | |
switch month { | |
case "December", "January", "February": | |
return "Winter" | |
case "March", "April", "May": | |
return "Spring" | |
case "June", "July", "August": | |
return "Summer" | |
case "Setpember", "October", "November": // Notice the typo for September | |
return "Autumn" |
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
func season(for month: String) -> String { | |
switch month { | |
case "December", "January", "February": | |
return "Winter" | |
case "March", "April", "May": | |
return "Spring" | |
case "June", "July", "August": | |
return "Summer" | |
case "September", "October", "November": | |
return "Autumn" |
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
func processingResult(for request: VNRequest) { | |
DispatchQueue.main.async { | |
let results = (request.results! as! [VNClassificationObservation]).prefix(2) | |
self.resultsLabel.text = results.map { result in | |
let formatter = NumberFormatter() | |
formatter.maximumFractionDigits = 1 | |
let percentage = formatter.string(from: result.confidence * 100 as NSNumber)! | |
return "\(result.identifier) \(percentage)%" | |
}.joined(separator: "\n") | |
self.showResultsView() |
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
// MARK: Function to classify image using the ML Model | |
func classify(image: UIImage) { | |
DispatchQueue.global(qos: .userInitiated).async { | |
let ciImage = CIImage(image: image)! | |
let imageOrientation = CGImagePropertyOrientation(rawValue: UInt32(image.imageOrientation.rawValue))! | |
let handler = VNImageRequestHandler(ciImage: ciImage, orientation: imageOrientation) | |
try! handler.perform([self.vnRequest]) | |
} | |
} |
NewerOlder