Skip to content

It's an app that would help users to find nearby Cafes, Bars and Restaurants.

License

Notifications You must be signed in to change notification settings

thiagocenturion/Nearby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iOS Nearby App

Swift iOS app showcasing nearby places using Google Places API.

Swift Version Build Status License Platform PRs Welcome

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.

Features

  • 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.

Run Sample

  1. Clone this repository.
    git clone https://github.com/thiagocenturion/Nearby.git
    
  2. Open Nearby/Nearby.xcodeproj in Xcode.
  3. Wait for Swift Package Dependencies to finish downloading.
  4. Run.

Requirements

  • iOS 13.0+
  • Xcode 12.2

Screenshots

Architecture Pattern

The architecture pattern for this application is MVVM with Coordinator. Below, you can view the architecture diagram for this project:

Unit Tests

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

Project Navigator for app target and unit test target:

Meta

Thiago Centurion – thiagocenturion@me.com

Distributed under the MIT license. See LICENSE for more information.

https://github.com/thiagocenturion/github-link

About

It's an app that would help users to find nearby Cafes, Bars and Restaurants.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages