This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent { | |
var child: Child? { | |
didSet { | |
child.callback = delegateCallback // Fix: child.callback = weakify(self, Parent.delegateCallback) using https://github.com/klundberg/Weakify/blob/master/Weakify/Weakify.swift#L15-L21 | |
} | |
} | |
func delegateCallback() { | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Parent { | |
var child: Child? { | |
didSet { | |
child.callback = weak(self)?.delegateCallback | |
} | |
} | |
func delegateCallback() { | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
info_plist="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" | |
spot_environment=$(echo "$GCC_PREPROCESSOR_DEFINITIONS" | sed -n 's/^.*ENVIRONMENT=\(.\)/\1/p') | |
facebook_url="fb0000000000${spot_environment}" | |
current_facebook_url=$(/usr/libexec/PlistBuddy -c "Print CFBundleURLTypes:0:CFBundleURLSchemes:0" "$info_plist") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol PubSubMessageType { | |
associatedtype Topic | |
var topic: Topic { get } | |
} | |
protocol PubSubType { | |
associatedtype Message = PubSubMessageType | |
associatedtype Topic | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef DEBUG | |
#import "WMLSwizzler.h" | |
static SEL wml_loadViewSEL; | |
static void wml_swizzleLoadViewForClass(Class class) { | |
typedef void(*load_view_t)(id, SEL); | |
__block load_view_t loadView = (load_view_t)[class S_replaceInstanceMethod:wml_loadViewSEL withBlock:^(UIViewController *self){ | |
loadView(self, wml_loadViewSEL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// flow controll using do-catch | |
do { | |
try commentBody(¿commentRangeBeforeOffset(¿getNameOffset(dictionary))) | |
} catch let e as OptionalError { | |
} catch { | |
} | |
// folding into optional value. Currently produces double optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target '…' do | |
end | |
post_install do |installer_or_rep| | |
installer = installer_or_rep.respond_to?(:installer) ? installer_or_rep.installer : installer_or_rep | |
installer.pods_project.build_configurations.each do |config| | |
# Only in debug | |
if config.name.include?("Debug") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
private var a1: Int! | |
private var a2: Int! | |
private var a3: Int! | |
private var a4: Int! | |
private var a5: Int! | |
private var a6: Int! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Some clearly non-NSObject-based models: | |
enum Coconut: String { | |
case small, medium, large | |
} | |
struct Tomato { | |
static var red = Tomato(color: #colorLiteral(red: 0.7490196078, green: 0.09803921569, blue: 0.02352941176, alpha: 1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let emojis: [String: [String]] = [ | |
// +[EMFEmojiCategory TravelAndPlacesEmoji] | |
"travel": ["🚗", "🚕", "🚙", "🚌", "🚎", "🏎", "🚓", "🚑", "🚒", "🚐", "🚚", "🚛", "🚜", "🛴", "🚲", "🛵", "🏍", "🚨", "🚔", "🚍", "🚘", "🚖", "🚡", "🚠", "🚟", "🚃", "🚋", "🚞", "🚝", "🚄", "🚅", "🚈", "🚂", "🚆", "🚇", "🚊", "🚉", "🚁", "🛩", "✈️", "🛫", "🛬", "🚀", "🛰", "💺", "🛶", "⛵️", "🛥", "🚤", "🛳", "⛴", "🚢", "⚓️", "🚧", "⛽️", "🚏", "🚦", "🚥", "🗺", "🗿", "🗽", "⛲️", "🗼", "🏰", "🏯", "🏟", "🎡", "🎢", "🎠", "⛱", "🏖", "🏝", "⛰", "🏔", "🗻", "🌋", "🏜", "🏕", "⛺️", "🛤", "🛣", "🏗", "🏭", "🏠", "🏡", "🏘", "🏚", "🏢", "🏬", "🏣", "🏤", "🏥", "🏦", "🏨", "🏪", "🏫", "🏩", "💒", "🏛", "⛪️", "🕌", "🕍", "🕋", "⛩", "🗾", "🎑", "🏞", "🌅", "🌄", "🌠", "🎇", "🎆", "🌇", "🌆", "🏙", "🌃", "🌌", "🌉", "🌁"], | |
// +[EMFEmojiCategory NatureEmoji] | |
"nature": ["🐶", "🐱", "🐭", "🐹", "🐰", "🦊", "🐻", "🐼", "🐨", "🐯", "🦁", "🐮", "🐷", "🐽", "🐸", "🐵", "🙈", "🙉", "🙊", "🐒", "🐔", "🐧", "🐦", "🐤", "🐣", "🐥", "🦆", "🦅", "🦉", "🦇", "🐺", "🐗", "🐴", "🦄", "🐝", "🐛", "🦋", "🐌", "🐚", "🐞", "🐜", "🕷", "🕸", "🐢", "🐍", "🦎", "🦂", "🦀", "🦑", "🐙", "🦐", "🐠", "🐟", "🐡", "🐬", "🦈 |