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
let a = NSURLQueryItem(name: "a", value: "yes") | |
let b = NSURLQueryItem(name: "b", value: "no") | |
let urlComponents = NSURLComponents(string: "https://hoge.com") | |
urlComponents!.queryItems = [a, b] | |
urlComponents!.URL | |
=> "https://hoge.com?a=yes&b=no" |
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
let japaneaseCalendar = Calendar(identifier: Calendar.Identifier.japanese) | |
var dateFormatter = DateFormatter() | |
dateFormatter.calendar = japaneaseCalendar | |
dateFormatter.dateFormat = "GGyy" | |
dateFormatter.locale = Locale(identifier: "ja_JP") | |
dateFormatter.string(from: Date()) |
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
let asset = AVAsset(url: sourceFileURL) | |
let dict = [AVSampleRateKey:44100, AVFormatIDKey:kAudioFormatLinearPCM] as [String : Any] | |
assetReaderOutput = AVAssetReaderAudioMixOutput(audioTracks: asset.tracks, audioSettings: dict) | |
do { | |
assetReader = try AVAssetReader(asset: asset) | |
if assetReader.canAdd(assetReaderOutput) { | |
assetReader.add(assetReaderOutput) | |
assetReader.startReading() | |
} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
class Hoge: NSObject, Comparable { | |
let text:String | |
init(text:String) { | |
self.text = text | |
} |
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
//: Playground - noun: a place where people can play | |
import UIKit | |
class Hoge: Comparable, Hashable { | |
let text:String | |
init(text:String) { | |
self.text = text | |
} |
OlderNewer