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 UIKit | |
class UIDirectionAbidingSlowingCollectionView : _UIDirectionAbidingCollectionView | |
{ | |
override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) | |
{ | |
super.init(frame: frame, collectionViewLayout: layout) | |
let decelerationRate : CGFloat = 0.996 | |
setValue(NSValue(cgPoint: CGPoint(x: decelerationRate, y: decelerationRate)), forKey: "_" + "decelerationFactor") |
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
Found these here... Seeems useful to have around every once in a blue moon (new machine) | |
https://stackoverflow.com/questions/37076718/increase-speed-to-xcode-builds-by-terminal-commands-only | |
There are more tips and tricks about how to decrease build timing. | |
Some of them are too old, other working only with simulator devices, other for example explain how to disable the code coverage support but always by make changes to the layout settings. | |
My purpose is to launch few effective terminal command lines or a good script (the last choice would be much better) so without changing Xcode layout settings, without adding libraries.., only by-terminal actions. |
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 StickyHeaderFlowLayout : UICollectionViewFlowLayout { | |
override init() { | |
super.init() | |
minimumInteritemSpacing = 0.0 | |
minimumLineSpacing = 0.0 | |
sectionInset = UIEdgeInsets.zero | |
scrollDirection = .vertical | |
} | |
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
extension Entry { | |
fileprivate static let contenfulEntryIDKey = "id" | |
var jsonResponse : [String : Any] { | |
var entryFields = fields | |
entryFields[Entry.contenfulEntryIDKey] = id | |
for (key, value) in entryFields | |
{ |
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
https://stackoverflow.com/questions/45250787/ios-correctly-adopting-a-view-into-an-already-visible-parent | |
extension UIViewController { | |
func adopChilViewController(_ childViewController: UIViewController) { | |
addChildViewController(childViewController) | |
view.addSubview(childViewController.view) | |
childViewController.didMove(toParentViewController: self) | |
} | |
} |
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
extension FileManager { | |
class func loadJSON(from file : String) -> Any? { | |
do { | |
if let file = Bundle.main.url(forResource: file, withExtension: "json") { | |
let data = try Data(contentsOf: file) | |
let json = try JSONSerialization.jsonObject(with: data, options: []) | |
if let dict = json as? [String: Any] { | |
return dict | |
} else if let array = json as? [Any] { |
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 UIKit | |
class UIDirectionAbidingCollectionView : UICollectionView { | |
override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) { | |
super.init(frame: frame, collectionViewLayout: layout) | |
setupDelayRecognizer() | |
} | |
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 SomeUIViewControllerExample: UIViewController { | |
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
view.addSubview(collectionView) | |
collectionView.frame = view.bounds | |
} | |
lazy var collectionView : UICollectionView = { | |
[unowned self] in |
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 NonBlinkyCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
override init() { | |
super.init() | |
minimumInteritemSpacing = 0.0 | |
minimumLineSpacing = 0.0 | |
sectionInset = UIEdgeInsetsZero | |
scrollDirection = .Vertical | |
} | |
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
// | |
// ViewController.swift | |
// SwiftLayout | |
// | |
// Created by Anton Doudarev on 5/24/16. | |
// Copyright © 2016 Anton Doudarev. All rights reserved. | |
// | |
import UIKit |