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
// | |
// TokenAcquisitionService.swift | |
// | |
// Created by Daniel Tartaglia on 16 Jan 2019. | |
// Copyright © 2024 Daniel Tartaglia. MIT License. | |
// | |
import Foundation | |
import RxSwift |
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
// UICollectionView Objective-C example | |
- (void)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
NSIndexPath *selectedIndexPath = [[self.collectionView indexPathsForSelectedItems] firstObject]; | |
if (selectedIndexPath != nil) { | |
id<UIViewControllerTransitionCoordinator> coordinator = self.transitionCoordinator; | |
if (coordinator != nil) { | |
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
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
// | |
// ComposeView.swift | |
import UIKit | |
class ComposeView: UIView { | |
// ........ | |
// Other layout code and methods | |
// ........ | |
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 | |
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { | |
@IBOutlet weak var tableView: UITableView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
NSLayoutConstraint.activate([ | |
tableView.topAnchor.constraint(equalTo: view.topAnchor), |
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 takeScreenshot(view: UIView) -> UIImageView { | |
UIGraphicsBeginImageContext(view.frame.size) | |
view.layer.renderInContext(UIGraphicsGetCurrentContext()) | |
let image = UIGraphicsGetImageFromCurrentImageContext() | |
UIGraphicsEndImageContext() | |
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil) | |
return UIImageView(image: image) | |
} |
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 | |
// MARK: - Comparable | |
extension NSDecimalNumber: Comparable {} | |
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool { | |
return lhs.compare(rhs) == .OrderedSame | |
} |