Swift iOS app showcasing nearby places using Google Places API.
Nearby is an app that helps users to find nearby Cafes, Bars and Restaurants.
This application allows you to see a list of nearby places, selecting one and openning it with Maps, Google Maps and Waze.
Nearby uses user's current location by CoreLocation
and gets nearby places from Google Places API.
- Reactive programming with RxSwift.
- MVVM with reactive Coordinator pattern.
- Reactive and componentized API services layer.
- Unit tested modules with Quick & Nimble.
- SOLID, Independency Injection, Stubs and Mocks.
- All dependencies using Swift Package Manager.
- JSON parses with SwiftyJSON.
- Localization in both English and Portuguese.
- Supports Dark and Light mode.
- Clone this repository.
git clone https://github.com/thiagocenturion/Nearby.git
- Open
Nearby/Nearby.xcodeproj
in Xcode. - Wait for Swift Package Dependencies to finish downloading.
- Run.
- iOS 13.0+
- Xcode 12.2
The architecture pattern for this application is MVVM with Coordinator. Below, you can view the architecture diagram for this project:
This project tests almost all MVVM-C layers. For that, it was necessary to create Stubs of UIKit native classes, such as UIViewController
, UINavigationController
, CLLocationManager
and UIApplication
using protocols.
Example:
protocol UIApplicationType: NSObject {
func canOpenURL(_ url: URL) -> Bool
}
extension UIApplication: UIApplicationType {}
Stub:
#if UNIT_TEST
import UIKit
final class UIApplicationStub: NSObject, UIApplicationType {
var canOpenURLCalls: [URL] = []
var canOpenURLResponse = true
func canOpenURL(_ url: URL) -> Bool {
canOpenURLCalls.append(url)
return canOpenURLResponse
}
}
#endif
Usage:
it("calls canOpenURL correctly") {
let applicationStub = UIApplicationStub()
expect(applicationStub.canOpenURLCalls.isEmpty) == true
_ = MapsActionSheetViewModel.mock(application: applicationStub)
expect(applicationStub.canOpenURLCalls.count) == 2
expect(applicationStub.canOpenURLCalls[0]) == URL(string: "https://somestuffurl.com")
expect(applicationStub.canOpenURLCalls[1]) == URL(string: "https://somesecondstuffurl.com")
}
Project Navigator for app target and unit test target:
Thiago Centurion – thiagocenturion@me.com
Distributed under the MIT license. See LICENSE
for more information.