This file contains hidden or 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: ASViewController<ASScrollNode>, UIScrollViewDelegate { | |
let someFixedNode: ASDisplayNode = { | |
let node = ASDisplayNode() | |
node.backgroundColor = .red | |
node.style.height = ASDimension(unit: .points, value: 250) | |
return node | |
}() | |
let someFlexibleNode: ASDisplayNode = { | |
let node = ASDisplayNode() |
This file contains hidden or 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
/usr/libexec/PlistBuddy path_to/Settings.bundle/Root.plist -c "Clear" | |
/usr/libexec/PlistBuddy path_to/Services.plist -c "Clear" |
This file contains hidden or 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
/// Register settings bundle in the app | |
public func registerSettingsBundle() { | |
let appDefaults = [String: AnyObject]() | |
UserDefaults.standard.register(defaults: appDefaults) | |
} |
This file contains hidden or 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
gradientLayer.startPoint = CGPoint(x: 0, y: 1) | |
gradientLayer.endPoint = CGPoint(x: 0, y: 0) |
This file contains hidden or 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
gradientLayer.startPoint = CGPoint(x: 0, y: 0) | |
gradientLayer.endPoint = CGPoint(x: 0, y: 1) |
This file contains hidden or 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
let gradientView = UIView(frame: CGRect(x: 0, y: self.textLabel.frame.maxY - 100, width: 375, height: 100)) | |
self.view.addSubview(gradientView) | |
let gradientLayer: CAGradientLayer = CAGradientLayer() | |
gradientLayer.frame = gradientView.bounds | |
// colors of your overlay. [0] - start color, [1] - end color | |
gradientLayer.colors = [UIColor(white: 1, alpha: 0.95).cgColor, UIColor(white: 1, alpha: 0.6).cgColor] | |
gradientLayer.startPoint = CGPoint(x: 0, y: 0) | |
gradientLayer.endPoint = CGPoint(x: 0, y: 1) | |
gradientView.layer.addSublayer(gradientLayer) | |
// rotate view 180 degrees |
This file contains hidden or 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
if let data = self.currentModel.imageData { | |
view.avatarImage.image = UIImage(data: data) | |
} else { | |
view.avatarImage.setImage(string: currentModel.username, color: UIColor.gray, circular: true, textAttributes: nil) | |
} | |
This file contains hidden or 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 ConversationsListInteractor: ConversationsListInteractorInput { | |
let chatsProvider: ChatsService = Assembler.container.resolve(ChatsProvider.self)! | |
weak var output: ConversationsListInteractorOutput? | |
// MARK: - Input | |
func requestItems(request: ConversationsList.DataContext.Request) { | |
DispatchQueue(label: "ConversationsListInteractor").async { | |
do { | |
let items = try self.chatsProvider.getChats(request: GetConversationsRequest(skip: request.skip, take: request.take)) | |
let models = items.map({ ConversationsListModel(currentModel: $0) }) |
This file contains hidden or 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 SwaggerClientAPI { | |
private enum HeadersKeys: String { | |
case authorization = "Authorization" | |
} | |
class func setBearer(_ token: String) { | |
SwaggerClientAPI.customHeaders = [HeadersKeys.authorization.rawValue: "Bearer \(token)"] | |
} | |
class func clearBearer() { | |
SwaggerClientAPI.customHeaders.removeValue(forKey: HeadersKeys.authorization.rawValue) | |
} |
This file contains hidden or 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 RemoteChatsProvider: ChatsProvider { | |
func getChats(request: GetConversationsRequest) throws -> [Message] { | |
var items: [MessageDto] = [] | |
var outputError: Error? = nil | |
let dispatchGroup = DispatchGroup() | |
dispatchGroup.enter() | |
CompanyMessagesAPI.companyMessagesGetConversations(request: request, completion: { (successfulResponse, error) in | |
do { | |
items = try SwaggerApiResponseHandler.unwrapResponse((successfulResponse, error)) |