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
// Extention | |
extension UILabel { | |
func color(_ color: UIColor)->UILabel { | |
self.textColor = color | |
return self | |
} | |
func font(_ name: String = "Helvetica ", size: CGFloat = 10)->UILabel { | |
self.font = UIFont(name: name, size: size) | |
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
import Foundation | |
import UIKit | |
public class Router { | |
static let window = UIApplication.shared | |
.connectedScenes | |
.filter({$0.activationState == .foregroundActive}) | |
.map({$0 as? UIWindowScene}) | |
.compactMap({$0}) | |
.first?.windows |
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
class LoginController: UIViewController { | |
@IBOutlet weak var lbl: UILabel? | |
@IBOutlet weak var inputField: UITextField! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// fetching from posts store |
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 Combine | |
class ViewController: UIViewController { | |
@IBOutlet weak var label: UILabel! | |
@IBOutlet weak var buttonUser: UIButton! | |
@IBOutlet weak var buttonPosts: UIButton! | |
var cancel = Set<AnyCancellable>() |
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
extension UIButton { | |
private func actionHandler(action:(() -> Void)? = nil) { | |
struct HandlerStruct { static var action :(() -> Void)? } | |
if action != nil { | |
HandlerStruct.action = action | |
} else { HandlerStruct.action?() } | |
} | |
@objc private func triggerActionHandler() { |
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
class ToolTipView: UILabel { | |
static let shared = ToolTipView() | |
enum Anchor { | |
case leading | |
case trailing | |
case center | |
} | |
private var anchor: Anchor = .leading |
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
enum TextType: CaseIterable { | |
case title | |
case subtitle | |
case sectionTitle | |
case body | |
case comment | |
} | |
struct EnumMap<Enum: CaseIterable & Hashable, Value> { |
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 ContentView: View { | |
@State var loginPresented = false | |
@State var activeSheet: ActiveSheet? | |
@State var loginConfig = LoginView.Configuration() | |
enum ActiveSheet { | |
case home, dashboard | |
} | |
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
class ProductViewModel: ObservableObject { | |
@Published var state: State = .isLoading | |
@Published var productName = "Sample" | |
@Published var formattedPrice = "100" | |
enum State { | |
case isLoading | |
case finishedLoading | |
} |
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 ContentView: View { | |
var body: some View { | |
ZStack { | |
Color.banescoBackground.ignoresSafeArea() | |
VStack { | |
Spacer() | |
Text("this is a convenient way to create this view controller without a imageURL this is a convenient way to create this view controller without a imageURL thing went worg.!") | |
} | |
} | |
.onAppear { |