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
CGFloat height = self.tableView.bounds.size.height - [UIApplication sharedApplication].statusBarFrame.size.height; | |
height = height - self.navigationController.navigationBar.frame.size.height; | |
height = height - self.tabBarController.tabBar.bounds.size.height; |
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
class ViewController: UIViewController { | |
func pickImage(fromSource sourceType: UIImagePickerControllerSourceType) { | |
guard UIImagePickerController.isSourceTypeAvailable(sourceType) else { return } | |
let imagePickerController = UIImagePickerController() | |
imagePickerController.sourceType = sourceType | |
imagePickerController.delegate = self | |
present(imagePickerController, animated: true, completion: nil) |
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
import Foundation | |
import RxSwift | |
let cars = Observable.from(["Nissan", "Ford", "BMW"]) | |
let tanks = Observable.from(["Tiger II", "T-44", "Panther"]) | |
let bikes = Observable.from(["Ducati", "Honda", "Kawasaki"]) | |
let landVehicles = Observable.of(cars, tanks, bikes).merge() | |
landVehicles.subscribe(onNext: { print($0) }) |
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
import UIKit | |
struct ImageStore { | |
static func delete(imageNamed name: String) { | |
guard let imagePath = ImageStore.path(for: name) else { | |
return | |
} | |
try? FileManager.default.removeItem(at: imagePath) |
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
import RxSwift | |
func submit(number: Int) { | |
let validateAndPerformServiceCallIfSuccessful = performValidation(numberThatShouldBeEven: number) | |
.flatMap { () -> Observable<Void> in | |
print("Validated successfully") | |
return performServiceCall() // For any .next events from performValidation, perform the service call | |
} | |
// By subscribing, validation is performed and the service call is executed for any .next events from performValidation |
NewerOlder