Skip to content

Instantly share code, notes, and snippets.

View rinat-enikeev's full-sized avatar

Rinat Enikeev rinat-enikeev

View GitHub Profile
func drawHorizontalGradient(over container : UIView, left leftColor: UIColor, right rightColor: UIColor) {
let maskLayer = CAGradientLayer()
maskLayer.colors = [leftColor.CGColor, rightColor.CGColor]
maskLayer.startPoint = CGPointMake(0.0, 0.5)
maskLayer.endPoint = CGPointMake(1.0, 0.5)
maskLayer.bounds = container.bounds
maskLayer.anchorPoint = CGPointZero
container.layer.insertSublayer(maskLayer, atIndex: 0)
}
@rinat-enikeev
rinat-enikeev / RECoreDataBase.swift
Last active November 12, 2015 11:08
Separate Persistence and Controllers layer in iOS with Swift. SEE LAST (USAGE) FILE. Write small, easy to read, fully featured and model change responsive UITableViewControllers.
// Copyright (c) 2015 Rinat Enikeev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
0xDDbd1FF8f241A2b806809741578eFFF029222DCd
0xDDbd1FF8f241A2b806809741578eFFF029222DCd
@rinat-enikeev
rinat-enikeev / ImageMessage.swift
Last active June 8, 2021 08:36
Chatto ImageMessage
// MARK: - ImageMessageModel
import Chatto
import ChattoAdditions
protocol ImageMessageModelProtocol: PhotoMessageModelProtocol {
var url: URL? { get set }
}
public class ImageMessageModel: PhotoMessageModel<MessageModel>, ImageMessageModelProtocol {
import UIKit
import BTKit
class ViewController: UITableViewController {
private var ruuviTagsSet = Set<RuuviTag>()
private var ruuviTags = [RuuviTag]()
override func viewDidLoad() {
super.viewDidLoad()