I hereby claim:
- I am alexito4 on github.
- I am alejandromp (https://keybase.io/alejandromp) on keybase.
- I have a public key whose fingerprint is F281 C10D C3E7 50B6 E256 ABCC DB9D C4B2 043A 15C9
To claim this, I am signing this object:
What's New in Swift | |
Creating Apps for a Global Audience | |
Introducing Podcast Analytics | |
What's New in Cocoa Touch | |
Using Accelerate and simd | |
Live Screen Broadcast with ReplayKit | |
I Have This Idea For An App... | |
Automatic Strong Passwords and Security Code AutoFill | |
Measuring and Optimizing HLS Performance | |
What’s New in ARKit 2 |
I hereby claim:
To claim this, I am signing this object:
protocol Stack { | |
typealias Element | |
mutating func push(value: Element) | |
mutating func pop() -> Element? | |
} | |
struct ArrayStack<T>: Stack { | |
.... |
require 'nokogiri-plist' | |
require 'uri' | |
class SRLItem | |
attr_accessor :title | |
attr_accessor :url | |
attr_accessor :source | |
def initialize(dict) |
#import <Foundation/Foundation.h> | |
#import "Smiler.h" | |
@interface Amazing : NSObject <Smiler> | |
@end |
local wait = 60 | |
os.loadAPI("weather") | |
local city = "London,uk" | |
while true do | |
local commandBlock = peripheral.wrap("back") | |
local w = weather.getWeather(city) |
// Understanding Value and Reference Types in Swift | |
/* | |
One of the coolest parts about Swift is how powerful all the types are. Structs are not like basic C structs, they have a lot of similarities with classes, and the same goes for the Enums. This is really good but also comes with the risk that newcomers doesn't know the differences between them. The oficial Swift blog has a great post about [Value and Reference Types](https://developer.apple.com/swift/blog/?id=10), read it. | |
In this post/playground I want to go step by step in some cases that will help newcomers understand how the different types work in Swift. It's good for people that comes form Objective-C to understand how Swift still has pointers, but hidden behind the language to make it safe. And for the newcomers, that doesn't know much about programming or *pointers*, will be good to understand what's actually happening behind the scenes. | |
## Categorization | |
Swift has two categories of Types: Value and Reference. |
import UIKit | |
protocol Thing { | |
func name() -> String | |
} | |
protocol God { | |
func talk() -> String | |
} |
#import <Foundation/Foundation.h> | |
// typedef | |
typedef NSString*(^ConvertBlock)(NSString *text); | |
@interface Thing : NSObject | |
@property (nonatomic, strong) void (^coolPropertyBlock)(NSString *text); // Property | |
// method param | |
- (void)doSomething:(void(^)(NSString *text))block with:(NSString *)person; |
import UIKit | |
enum Size: Int, CustomStringConvertible { | |
case S = 0 | |
case M | |
case L | |
case XL | |
static func allValues() -> [String] { |