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
// | |
// String+IntRange.swift | |
// | |
// Created by Zack Sheppard on 8/30/20. | |
// Copyright © 2020 Zack Sheppard. All rights reserved. | |
// Freely usable under the Apache 2.0 License. | |
// | |
import Foundation | |
/// This extension is freely available at |
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 | |
// Swift 4.2.1 syntax | |
public struct SubstringMatchSource<S: StringProtocol> where S.Index == String.Index { | |
private let wrapped: S | |
public init(wrapping wrapped: S) { | |
self.wrapped = wrapped | |
} |
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
struct Contact: CustomStringConvertible { | |
let user: User | |
let address: Address | |
let deliveryInstruction: String | |
let deliveryMethod: String | |
// customize the description to your needs | |
var description: String { return "\(user.name) \(deliveryInstruction) \(deliveryMethod)" } | |
init(dictionary: [String: Any]) { | |
self.deliveryInstruction = dictionary["delivery_instruction"] as? String ?? "" | |
self.deliveryMethod = dictionary["delivery_method"] as? String ?? "" |