Giter Site home page Giter Site logo

pullmeetupnearyourdevice's Introduction

####Meetup Events pulling from your device’s location. 🚲

<img src = "https://github.com/guangLess/pullMeetupNearYourDevice/blob/master/screenShot/guang-appwalkthrough-ny2.gif" width = 200">

If location in simulator is not set up, the default location is New York. The api key in this repo is free to use.

Summery : The app requests device location, then uses the location coordinates to request Meetup's open api /2/open_events with the user’s latitude/longitude. It displays 10 events ordered by distance to the user on a table view, and shows the relevant city name at the top of the screen. Tapping into each event shows the details of the event along with a favorite button than can be toggled (and remembers changes).

——-Networking—— struct Event is a model structured around the specs required for this code test (event/ group names, rsvp, who, time, etc). Event’s optional init method is used to help parse JSON data results in the networking call.

struct Resource is an abstract structure with a variable url, and a closure variable that takes NSData, then uses NSJSONSerialization to return a generic type. Since Event is the data type that is being conformed later, it is better to keep each modular independent (which I learned from objc.io).

class MeetupService handles networking requests with NSURLSession, function load captures the data returned from Meetup service, and struct Resource parses this returned data and captures it as an array of type Event.

——-Location—- struct DeviceLocation is a location related model with variables of lat, long, and cityName for data. However, city name is a result from reverseGeocodeLocation, his method takes time. Its return String cityName was not actually used as I designed to. The city name is copied from Meetup api ca

struct DeviceLocation is a location related model containing variables of lat, long, and cityName. I wrote a method to convert the lat/long to a city name using reverseGeocodeLocation, but realized the threading time was unexpectedly slower to return a result. This is an area I would improve, but for the short time of the code test, I decided to take the city name of the venue from the closest Event for a quick fix.

class Location conforms to CLLocationmanagerDelegate. It requests device’s location while using the app. Request stops after the location is found.

—-Protocols——- canGetLocation protocol handles location request. LoadingAPI protocol handles Meetup api calls.

ViewController adapts canGetLocation and LoadingAPI protocols. EventViewController shows the detail of the event.

eventList Array is a global variable that stores the events. It’s not the best practice for a real app, however I needed it to be global in order to save the favorite states from EventViewController.

pullmeetupnearyourdevice's People

Contributors

guangless avatar orta avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.