Skip to content

Instantly share code, notes, and snippets.

View ignazioc's full-sized avatar
:octocat:

Ignazio ignazioc

:octocat:
View GitHub Profile
if v1 {
if (v2) {
print("tt")
} else {
print("tf")
}
} else {
if v2 {
print("ft")
} else {
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .gray
let textView = UITextView(frame: CGRect(x: 20.0, y: 30.0, width: 300.0, height: 400.0))
textView.textColor = UIColor.blue
//: Playground - noun: a place where people can play
import UIKit
//Everything starts with defining a protocol
protocol Logger {
func log(_ mex: String)
}
//This is one implementation of the protocol
{
"flags": [
{
"featureName": "ads_audioload_frequency",
"cell": "Control"
},
{
"featureName": "NTX_artist_published_playlists_position",
"cell": "B"
},
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
struct User {
var name: String
init() {
@ignazioc
ignazioc / indirect enum.swift
Created February 12, 2017 21:07
Example of indirect enum with Swift3
import Cocoa
enum DataStructure {
case node(value: String)
indirect case tree(left: DataStructure, right: DataStructure)
}
let nodeA = DataStructure.node(value: "A")
let nodeB = DataStructure.node(value: "B")
@ignazioc
ignazioc / autoclousure.swift
Created February 12, 2017 10:39
A simple explanation of the @autoclosure keyword
/*:
### Swift 3 @autoclosure
*/
import Cocoa
// Let's suppose this is complex funcion with lookup database etc.
func nextOrderNumber() -> Int {
return 1000
}

Keybase proof

I hereby claim:

  • I am ignazioc on github.
  • I am ignazioc (https://keybase.io/ignazioc) on keybase.
  • I have a public key whose fingerprint is 40DB 4C53 E3B1 6F85 5CC2 B45B 6A22 414B 04AC FACA

To claim this, I am signing this object: