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
tableView.register(MyCell.self, forCellReuseIdentifier: MyCell.reuseIdentifier) |
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
// Say you're on the main thread | |
DispatchQueue.global(qos: DispatchQoS.QoSClass.background).async { | |
// Do something expensinve in background | |
var mySuperLongComputedResult = computeSuperLongStuff() | |
DispatchQueue.main.async { | |
// come back to the main thread to ping UI | |
label.text = mySuperLongComputedResult | |
} | |
} |
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
public extension Optional where Wrapped == String { | |
var isEmptyOrNil: Bool { return (self ?? "").isEmpty } | |
} |
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 <#Depencency#> { | |
func foo() | |
} | |
protocol Has<#Depencency#> { | |
func get<#Depencency#> () -> <#Depencency#> | |
} | |
// Implementation |
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
// | |
// View.swift | |
// heroandstevia | |
// | |
// Created by Sacha on 31/07/2018. | |
// Copyright © 2018 Onur Geneş. All rights reserved. | |
// | |
import UIKit | |
import Stevia |
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
// | |
// ViewController.swift | |
// steviademo | |
// | |
// Created by Onur Geneş on 17.07.2018. | |
// Copyright © 2018 Onur Geneş. All rights reserved. | |
// | |
import UIKit | |
import Stevia |
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
package com.octopepper.yummypets.component.dogchow | |
import android.content.Context | |
import android.util.AttributeSet | |
import android.view.View | |
import android.widget.LinearLayout | |
import com.octopepper.yummypets.R | |
import kotlinx.android.synthetic.main.dogchow_benefit.view.* | |
class DogchowBenefitView(context: Context, attrs: AttributeSet) : LinearLayout(context, attrs) { |
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
// | |
// ThreadSafe.swift | |
// ThreadSafeArray | |
// | |
// Created by Sacha DSO on 20/09/2018. | |
// Copyright © 2018 freshOS. All rights reserved. | |
// | |
import Foundation |
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
public class Channel<Message: Equatable>: IsChannel { | |
private var subscriptions = ThreadSafeArray<Subscription>() | |
public func broadcast(_ message: Message) { | |
subscriptions.forEach { $0.trigger(message: message) } | |
} | |
public func subscribe(_ object: AnyObject, | |
for specificMessage: Message, |
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
package main | |
func main() { | |
// Create our dependency. | |
lf := FileLinkFetcher{} | |
// lf := DatabaseLinkFetcher{} | |
// Here we "inject" the fileLinkFetcher in the App constructor. |