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 DataRequest { | |
| /// Decodes the response to a type `T` or` APIError`. | |
| /// | |
| /// NB: The serializer used `TwoDeodableResponseSerializer` doesn't throw though Alamofire | |
| /// response serializer expects to receive a `DataResponse`. All errors/failures are converted to an `APIError`. | |
| /// | |
| /// - Parameters: | |
| /// - t: Type to decode to | |
| /// - queue: `DispatchQueue` to dispatch `completionHandler` |
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
| // | |
| // AuthenticationDataHandler.swift | |
| // Bonfire | |
| // | |
| // Created by Charles Muchene on 2/10/20. | |
| // Copyright © 2020 SenseiDevs. All rights reserved. | |
| // | |
| import Alamofire | |
| import Foundation |
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
| interface UseCase { | |
| fun invoke() | |
| } | |
| class UseCaseImpl: UseCase { | |
| override fun invoke() { | |
| println("Invalidate cache") | |
| } | |
| } |
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
| protocol UseCase { | |
| func invoke() | |
| } | |
| class UseCaseImpl: UseCase { | |
| func invoke() { | |
| debugPrint("Invalidate cache") | |
| } | |
| } |
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
| interface UseCase { | |
| operator fun invoke() | |
| } | |
| class UseCaseImpl: UseCase { | |
| override fun invoke() { | |
| println("Invalidate cache") | |
| } | |
| } |
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
| @dynamicCallable | |
| protocol UseCase { | |
| func invoke() | |
| } | |
| extension UseCase { | |
| func dynamicallyCall(withArguments: [Void]) { | |
| invoke() | |
| } | |
| } |
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
| data class Toy(val id: String, val name: String, val color: Int) |
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
| class ToyViewHolder(view: View) : RecyclerView.ViewHolder(view) { | |
| fun bind(toy: Toy) { | |
| // TODO Bind toy to view | |
| } | |
| } |
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
| class ToyViewAdapter : RecyclerView.Adapter<ToyViewHolder>() { | |
| private val toys = mutableListOf<Toy>() | |
| fun addToys(vararg toys: Toy) { | |
| val start = toys.size - 1 | |
| this.toys.addAll(toys) | |
| notifyItemRangeInserted(start, toys.size) | |
| } |
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
| interface Unique<T> { | |
| val id: T | |
| } |
OlderNewer