This file contains hidden or 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 SwiftUI | |
import Combine | |
public struct BottomSheet<Content>: View where Content : View { | |
/// The content of the scroll view. | |
public var content: Content | |
/// The offset of the scrollview updated as the scroll view scrolls | |
@Binding public var offset : CGSize |
This file contains hidden or 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
// This code accompanies a blog post: http://chris.eidhof.nl/posts/json-parsing-in-swift.html | |
// | |
// As the >>= operator is already defined, so I changed it to >>>= | |
import Foundation | |
let parsedJSON : [String:AnyObject] = [ | |
"stat": "ok", | |
"blogs": [ |
This file contains hidden or 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
// This code accompanies a Swift meetup video on Realm: http://realm.io/news/functional-programming-swift-chris-eidhof/ | |
// | |
// As the >>= operator is already defined, so I changed it to >>>= | |
import Foundation | |
let parsedJSON : [String:AnyObject] = [ | |
"stat": "ok", | |
"blogs": [ |
This file contains hidden or 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
// Playground - noun: a place where people can play | |
import Foundation | |
import UIKit | |
//~~~~~~~~~~~~~~~~ Error handling with enum Result<A> ~~~~~~~ | |
enum Result<A> { | |
case Error(NSError) | |
case Value(Box<A>) |
This file contains hidden or 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
extension String { | |
func toEnum<Enum: RawRepresentable where Enum.RawValue == String>() -> Enum? { | |
return Enum(rawValue: self) | |
} | |
} | |
class ViewController: UIViewController { | |
............. |
This file contains hidden or 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
// Playground - noun: a place where people can play | |
import Foundation | |
/*let parsedJSON : [String:AnyObject] = [ | |
"id": 1, | |
"name": "Cool User", | |
"email": "[email protected]" | |
] |
This file contains hidden or 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
// Playground - noun: a place where people can play | |
import Foundation | |
// ДЛЯ СТАТЬИ http://nomothetis.svbtle.com/error-handling-in-swift | |
// Управление ошибками в Swift: магия и реальность - Часть 2 | |
// http://www.bestkora.com/SwiftLearning/upravlenie-oshibkami-v-swift-magiya-i-realn/ | |
// ============= Обычная функция =========== | |
func divide0 (a: Float, by: Float ) -> Float { |