Duration: 3 months
Anticipate upcoming iOS and macOS platforms converging.
Master development for a new platform: macOS.
| 1. Очень крутая книжка по сетям (стек OSI) – Charles Severance “Introduction to Network: How the Internet works” | |
| 2. URLCache – https://nshipster.com/nsurlcache/ | |
| 3. Ресёрч HTTP-кеширования с использованием URLCache https://qnoid.com/2016/04/10/A-primer-in-HTTP-caching-and-its-native-support-by-iOS.html | |
| 4. Анализ доступности сети: | |
| * SimplePing – https://developer.apple.com/library/archive/samplecode/SimplePing/Introduction/Intro.html | |
| * https://github.com/dustturtle/RealReachability | |
| * https://github.com/ankitthakur/SwiftPing | |
| * https://github.com/lmirosevic/GBPing | |
| * https://github.com/rwbutler/Connectivity | |
| * Баг с 2009 года – https://lists.apple.com/archives/macnetworkprog/2009/May/msg00056.html |
Author: Chris Lattner
| import UIKit | |
| open class LayerView<Layer: CALayer>: UIView { | |
| public final override class var layerClass: Swift.AnyClass { | |
| return Layer.self | |
| } | |
| public final var concreteLayer: Layer { | |
| return layer as! Layer | |
| } |
| import UIKit | |
| class ChatCollectionViewFlowLayout: UICollectionViewFlowLayout { | |
| private var topMostVisibleItem = Int.max | |
| private var bottomMostVisibleItem = -Int.max | |
| private var offset: CGFloat = 0.0 | |
| private var visibleAttributes: [UICollectionViewLayoutAttributes]? |
| /** | |
| * Based on https://gist.github.com/mikelehen/3596a30bd69384624c11#file-generate-pushid-js | |
| * | |
| * Fancy ID generator that creates 20-character string identifiers with the following properties: | |
| * | |
| * 1. They're based on timestamp so that they sort *after* any existing ids. | |
| * 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
| * 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
| * 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
| * latter ones will sort after the former ones. We do this by using the previous random bits |
You can use this class to realize a simple sectioned grid RecyclerView.Adapter without changing your code.
The RecyclerView has to use a GridLayoutManager.
This is a porting of the class SimpleSectionedListAdapter provided by Google
If you are looking for a sectioned list RecyclerView.Adapter you can take a look here
| - (UIImage *)fixRotation | |
| { | |
| if (self.imageOrientation == UIImageOrientationUp) return self; | |
| CGAffineTransform transform = CGAffineTransformIdentity; | |
| switch (self.imageOrientation) { | |
| case UIImageOrientationDown: | |
| case UIImageOrientationDownMirrored: | |
| transform = CGAffineTransformTranslate(transform, self.size.width, self.size.height); | |
| transform = CGAffineTransformRotate(transform, M_PI); |
| import UIKit | |
| import Security | |
| class Keychain { | |
| class func save(key: String, data: NSData) -> Bool { | |
| let query: [String: AnyObject] = [ | |
| kSecClass : kSecClassGenericPassword, | |
| kSecAttrAccount : key, | |
| kSecValueData : data ] |
| /* | |
| * Copyright (C) 2014 skyfish.jy@gmail.com | |
| * | |
| * 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 |