(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
// | |
// Obfuscator.swift | |
// | |
// Created by Dejan Atanasov on 2017-05-31. | |
// | |
import Foundation | |
class Obfuscator: AnyObject { | |
//: # Swift 3: Working with dates | |
import Foundation | |
let date = Date() | |
let myLocale = Locale(identifier: "bg_BG") | |
//: ### Setting an application-wide `TimeZone` | |
//: Notice how we use if-let in case the abbreviation is wrong. It will fallback to the default timezone in that case. | |
if let myTimezone = TimeZone(abbreviation: "EEST") { | |
print("\(myTimezone.identifier)") |
/* DeviceUID.h | |
#import <Foundation/Foundation.h> | |
@interface DeviceUID : NSObject | |
+ (NSString *)uid; | |
@end | |
*/ | |
// Device.m |
// | |
// Regex.swift | |
// Jitta | |
// | |
// Created by Yuttana Kungwon on 3/6/2559 BE. | |
// Copyright © 2559 Jitta Company. All rights reserved. | |
// | |
import Foundation |
- (void)testAsynchronousURLConnection { | |
// Create request | |
NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/get"]; | |
NSString *description = [NSString stringWithFormat:@"GET %@", URL]; | |
XCTestExpectation *expectation = [self expectationWithDescription:description]; | |
NSURLSession *session = [NSURLSession sharedSession]; |
// | |
// ViewController.swift | |
// Delete | |
// | |
// Created by Mike Chirico on 10/21/15. | |
// Copyright © 2015 Mike Chirico. All rights reserved. | |
// | |
import UIKit |
func abbreviateNumber(num: NSNumber) -> String { | |
// less than 1000, no abbreviation | |
if num < 1000 { | |
return "\(num)" | |
} | |
// less than 1 million, abbreviate to thousands | |
if num < 1000000 { | |
var n = Double(num); | |
n = Double( floor(n/100)/10 ) |
/* DeviceUID.h | |
#import <Foundation/Foundation.h> | |
@interface DeviceUID : NSObject | |
+ (NSString *)uid; | |
@end | |
*/ | |
// Device.m |
/* | |
* Copyright (C) 2014 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.