Skip to content

Instantly share code, notes, and snippets.

//: Playground - noun: a place where people can play
import UIKit
import Foundation
import PlaygroundSupport
//https://habrahabr.ru/post/103681/
protocol MyProtocol{
//Можем объявить статическую функцию в протоколе
static func someFunc()-> String
//: Playground - noun: a place where people can play
import UIKit
import Foundation
import PlaygroundSupport
//https://habrahabr.ru/post/103681/
protocol MyProtocol{
//Можем объявить статическую функцию в протоколе
static func someFunc()-> String
@OctoberHammer
OctoberHammer / delgate, reloaddata
Last active September 30, 2022 11:03
swift.swift
import Foundation
import UIKit
class ViewControllerAdd: UIViewController {
var delegate : DataTableView?
@IBAction func exittoVC(_ sender: Any) {
delegate?.relodeTableView()
self.dismiss(animated: true, completion: nil)
class ViewControllerAdd: UIViewController {
var delegate : DataTableView?
@IBAction func exittoVC(_ sender: Any) {
delegate?.relodeTableView()
self.dismiss(animated: true, completion: nil)
}
}
class ViewControllerAdd: UIViewController {
var delegate : DataTableView?
@IBAction func exittoVC(_ sender: Any) {
delegate?.relodeTableView()
self.dismiss(animated: true, completion: nil)
}
}
Your code here
//: Playground - noun: a place where people can play
import UIKit
import Foundation
enum MyErrors: Error {
case DivisionByZero
}
//MARK: Описываем функцию, которая будент выкидывать исключение, при попытке деления на ноль.
func divide(_ what: Float, by divider: Float) throws -> Float? {
import UIKit
import Foundation
class ConnectBLE {
var callBackFunc: ()->()
init(callFunc: @escaping () -> ()){
callBackFunc = callFunc
}
}
@OctoberHammer
OctoberHammer / playground.swift
Created May 28, 2017 18:01
Modify Value for a certain key of a Dictionary
//: Playground - noun: a place where people can play
import UIKit
import Foundation
var dictOfProductsForCategory: [Int: [[String:Any]]] = [:]
//I want dictOfProductsForCategory[3183] eventually to be set with 4-items Array
//How can I do this?
var result1: [[String:Any]]? = [["id":5, "title": "Some Title"], ["id":6, "title": "Another Title"]]
@OctoberHammer
OctoberHammer / Playground.swift
Last active May 27, 2017 19:53
Convert from Any? into Int32?
//: Playground - noun: a place where people can play
import UIKit
import Foundation
//Пробовать с разными - раскоментаривать по очереди
var someString: String? = "bjbb"
//var someString: String? = "3456"
//var someString: Int? = 3456