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 | |
import Combine | |
struct Post { | |
let imageName: String | |
let description: String? | |
init(imageName: String, description: String? = nil) { | |
self.imageName = imageName | |
self.description = description |
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 | |
extension Int { | |
/// Returns the Hebrew numeral represented by the receiver's value. | |
/// | |
/// Example: A value of 1 retuns א׳. | |
/// A value of 0 or any value above one million returns the value in regular Arabic numerals. | |
func toHebrewNumeral() -> String { | |
let absoluteSelf = abs(self) | |
// `DateFormatter` won't use Hebrew numerals after a million so simply return self. |
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
/// A `UIViewController` that has a matching storyboard file with the same name. | |
protocol Storyboardable where Self: UIViewController {} | |
extension Storyboardable { | |
/// Returns a `UIViewController` instance with the initial view controller of the matching storyboard file in the given bundle. | |
static func storyboardInstance(bundle: Bundle = Bundle.main) -> Self { | |
let className = String(describing: Self.self) | |
let storyboard = UIStoryboard(name: className, bundle: bundle) | |
if let initialViewController = storyboard.instantiateInitialViewController() as? Self { | |
return initialViewController |