Skip to content

Instantly share code, notes, and snippets.

View InstaRobot's full-sized avatar
:electron:
I don't know ...

Vitaliy Podolskiy InstaRobot

:electron:
I don't know ...
View GitHub Profile
// Интерфейсное объявление класса
- (NSURL *)applicationDocumentsDirectory;
// конец интерфейса
//=======================================
// Раздел реализации класса
@InstaRobot
InstaRobot / SignRequest.h
Created May 31, 2016 08:43
sig sign for POST methods
//
// SignRequest.h
// CryptClassPro
//
// Created by VITALIY PODOLSKIY on 01/08/15.
// Copyright © 2015 VITALIY PODOLSKIY. All rights reserved.
//
#import <Foundation/Foundation.h>
//
// AppsViewController.h
// Clean for VK
//
// Created by VITALIY PODOLSKIY on 01/10/15.
// Copyright © 2015 VITALIY PODOLSKIY. All rights reserved.
//
#import "BaseViewController.h"
// В пргументах схемы добавить ключ:
-com.apple.CoreData.SQLDebug 1
// Создаем пустой swift файл и вставляем в него код
import UIKit
@IBDesignable class GraphView: UIView {
//1 - the properties for the gradient
@IBInspectable var startColor: UIColor = UIColor.redColor()
@IBInspectable var endColor: UIColor = UIColor.greenColor()
override func drawRect(rect: CGRect) {
@InstaRobot
InstaRobot / UITableViewRowAction картинка вместо текста.swift
Created May 31, 2016 08:39
Можно быстро заменить текст картинкой
class TableViewRowAction: UITableViewRowAction {
var image: UIImage?
func _setButton(button: UIButton) {
if let image = image, let titleLabel = button.titleLabel {
let labelString = NSString(string: titleLabel.text!)
let titleSize = labelString.sizeWithAttributes([NSFontAttributeName: titleLabel.font])
button.tintColor = UIColor.whiteColor()
button.setImage(image.imageWithRenderingMode(.AlwaysTemplate), forState: .Normal)
button.imageEdgeInsets.right = -titleSize.width
@InstaRobot
InstaRobot / Reachability.swift
Created May 31, 2016 08:38
Правильный и работающий способ проверки соединения к сети
import SystemConfiguration
class Reachability {
class func isConnectedToNetwork() -> Bool {
var zeroAddress = sockaddr_in()
zeroAddress.sin_len = UInt8(sizeofValue(zeroAddress))
zeroAddress.sin_family = sa_family_t(AF_INET)
guard let defaultRouteReachability = withUnsafePointer(&zeroAddress, {
SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
func makeUrl(url: String) -> String {
var contents: String = ""
if let urlApi = NSURL(string: "https://clck.ru/--?url=\(url)") {
do {
contents = try String(contentsOfURL: urlApi, usedEncoding: nil)
print(contents)
} catch {
}
} else {