GithubHelp home page GithubHelp logo

foodchooser's Introduction

FoodChooser

FoodChoose lets you easily choose a food from variety of cuisines. You can also find recipes for the food or find restaurants near you.

Choose a Food Find a Recipe Find a restraunt

Contents


Why?

I wanted an app that allows you to:

  • Make choice between random food.
  • Find near by restaurants of selected menu.
  • Find a recipe for selected menu and make it by yourself.

So that by using this app people will save time from browsing these information separately.


Installation

  1. Install the project.
  1. Create a new scheme name same as 'FoodChooser'
  2. Get API keys for :
  1. Copy and paste your Api keys to the project's Constant.swift file.

Usage

The primary purpose of this project is to help people choose what to eat for a meal. Many people today have diffuculty choosing what to eat everyday. If you are in this case, open FoodChoose App. This app will show random food images one by one on the screen. If you dont like the food on the screen, simply swipe the finger to left. Then new menu will appear. Keep doing this until you find the menu you want to eat. After you decide the menu, you can either find nearby restranut or find recipes for the menu. If choose to eat in the restranut, just click the button that says find restraunt. Button will lead you to map, which shows your current position in the map and near by restraunts information. If you choose to make food by your self, click the see the recipe button and it will lead you to variety of recipes for the menu. Next select the recipe you want to make, and recipe site will be show.


How FoodChooser is made

  1. Data Structure
  • FoodData - Store data for menu selection. Array of struct of Food.
  • Food
  • English name
  • Korean name
  • image name
  • FoodRecipe - Result of Recipe Food Nutrition API. Contains information about recipes of certain menu.
  • Result
  • title
  • sourceUrl
  • readyInMinutes
  • image
  • DaumSearchData - Result of Kakao Map API. Contains information about near by restaurant of user.
  • PlaceInfo
  • place_name
  • address_name
  • phone
  • x
  • y
  1. APIs
  • Recipe Food Nutrition API - When user selects a menu, menu's name will be sent to the Recipe Food Nutrition API's end point. Then, Api retruns recipes for the menu.
  • Kakao Map API - When user selects a menu, Kakao Map Api will search the menu in Kakao Map near where you are. Providing restruant information.
  1. UI
  • Image Swiping - Showing one image at a time, making user concentrate to only one menu at a time. If like the menu user will select button to proceed. If do not like the menu, user will swipe the screen to see the next random food.
  1. Data Flow
  • Food Recipe Flow
  1. Food Data - Menu is chosen by the user. Menu's information is passed to Recipe Food Nutrition API.
  2. FoodRecipe - Recipe Food Nutrition API returns recipes for the menu.
  3. sourceUrl - Url is used to show the recipe site.
  • Map Flow
  1. Food Data - Menu is chosen by the user. Menu's information is passed to Kakao Map API.
  2. DaumSearchData - Kakao Map Api returns restaurants' information.
  3. Using DaumSearchData marks locations of restaurant and your current location.

Fixes

  • Recipe TableView loading problem.

Original image fetching code.

  
   let url = URL(string: imageBaseUrl + decodedData!.results[indexPath.row].image)
        let data = try! Data(contentsOf: url!)
        cell.foodThumNail.image = UIImage(data: data)
   
   

Fixed image fetching code.

 
  private func fetchImage() {
        if let url = thumnailUrl {
            DispatchQueue.global(qos: .userInitiated).async { [weak self] in
                let urlContents = try? Data(contentsOf: url)
                DispatchQueue.main.async {
                    if let imageData = urlContents {
                        if let imag = UIImage(data: imageData){
                            self?.foodThumNail.image = imag
                        }else{
                            print("no image available")
                        }
                    }
                }
            }
        }
    }
    
    var thumnailUrl : URL?{
        didSet {
            if thumnailUrl != nil && (oldValue != thumnailUrl) {
                fetchImage()
            }
        }
    }
    
    cell.thumnailUrl = URL(string: imageBaseUrl + decodedData!.results[indexPath.row].image)
 
 
  • Recipe Browser problem. When getting recipe url, url had both http and https format. Resulting

foodchooser's People

Contributors

yleer avatar

Watchers

 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.