Design Pattern

What’s a design pattern? Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code. You can’t just find a pattern and copy it into your program, the way you can with off-the-shelf functions or libraries. The …

Design Pattern Read More »

S.O.L.I.D Principles

The SOLID Principles S — Single Responsibility A class should have a single responsibility If a Class has many responsibilities, it increases the possibility of bugs because making changes to one of its responsibilities, could affect the other ones without you knowing. Goal This principle aims to separate behaviours so that if bugs arise as …

S.O.L.I.D Principles Read More »

How to Activity Indicator SwiftUI

struct ActivityIndicator: UIViewRepresentable { @Binding var isAnimating: Bool let style: UIActivityIndicatorView.Style func makeUIView( context: UIViewRepresentableContext) -> UIActivityIndicatorView { return UIActivityIndicatorView(style: style) } func updateUIView(_ uiView: UIActivityIndicatorView, context: UIViewRepresentableContext) { if isAnimating { uiView.startAnimating() } else { uiView.stopAnimating() } } } struct LoadingView: View where Content: View { @Binding var isShowing: Bool var content: () -> …

How to Activity Indicator SwiftUI Read More »