A simple app project utilizing Apple's SwiftUI and Combine framework built with the MVVM architecture
This project uses SwiftUI with SwiftUI Views, Views bridging to UIKit views, a network client that performs HTTP requests and structured using the MVVM (Model-View-ViewModel) architecture pattern, so this setup could potentially be used in large scale production apps, of course depending on the needs of the given app.
- By typing in a search query the app can search for street addresses in Denmark using the DAWA API.
- It uses a custom
SearchBar
component with an inline activity indicator. - The
SearchAddressViewModel
handles input from the views text field using Apple'sCombine
framework. The@Published
searchText
property has a 500 millisec debounce rate and removal of duplicates to avoid spamming the external API.
- The
DraggableCard
component can be used to overlay data on top of some parent view. In this case it is used to display data about the selected address on top of the map view- SwiftUI
features aDragGesture
that is used to handle dragging of the card and animation is done with aninterpolatingSpring
animation to provide the feeling of the card snapping to the defined positions.
- Creating an address doesn't really make much sense in the real world but it is used here as an example on how to aggregate the result of multiple
Publishers
into one combined result/value in theCreateAddressViewModel
- The
Combine
frameworks features theCombineLatest
which publishes the aggregated result oftitleValidation
andsubtitleValidation
into thevalidationResult
which then publishes it result to any subscribers.