---intro---
Nutrionapp is a nutrition app that assists people in pursuing a healthy and nutrient balanced lifestyle. The app is powered by the Nutritionix Database that has data on over 1 million data points on common foods, grocery and restaurant items. The app can suggest, track, customize a healthy diet for you ensuring each one of your users to be as healthy as possible. The app can also suggest the most cost efficient location to purchase these items.
[Evaluation of your app across the following attributes]
Required Must-have Stories
Optional Nice-to-have Stories
Tab Navigation (Tab to Screen)
Optional:
Flow Navigation (Screen to Screen)
[Picture of hand sketched wireframes section:]
[This section will be completed in Unit 9]
[A table of models for Reading from database] {optional- currently app do not need user database- that is Beta version} | Property | Type | Description |
---|---|---|---|
objectId | String | unique id for the user post (default field) | |
author | Pointer to User | image author | |
image | File | image that user posts | |
caption | String | image caption by author | |
commentsCount | Number | number of comments that has been posted to an image | |
likesCount | Number | number of likes for the post | |
createdAt | DateTime | date when post is created (default field) | |
updatedAt | DateTime | date when post is last updated (default field) |
[Add list of network requests by screen ]
Profile Screen (Beta)
(Read/GET) Query all posts where user is author -> the code below will be the Query calls for all our objects and endpoints.
let params = ["username":"john", "password":"123456"] as Dictionary<String, String>
var request = URLRequest(url: URL(string: "http://localhost:8080/api/1/login")!)
request.httpMethod = "POST"
request.httpBody = try? JSONSerialization.data(withJSONObject: params, options: [])
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
let session = URLSession.shared
let task = session.dataTask(with: request, completionHandler: { data, response, error -> Void in
print(response!)
do {
let json = try JSONSerialization.jsonObject(with: data!) as! Dictionary<String, AnyObject>
print(json)
} catch {
print("error")
}
})
task.resume()
[OPTIONAL: List endpoints if using existing API such as Yelp] | Property | Type | Description c | Endpoints |
---|---|---|---|---|
search_food | Dictionary-JSON | GET/POST-basic search for food options | https://trackapi.nutritionix.com/v2/search/instant | |
search_restaurants | Dictionary-JSON | GET/POST-basic search for resturant suggestions | https://trackapi.nutritionix.com/v2/locations | |
search_nutrients | Dictionary-JSON | GET/POST-basic search for nutrient dataBase contents | https://trackapi.nutritionix.com/v2/natural/nutrients | |
natural/nutrients | String-QUERY | users can get detailed nutrient break down when they search for a product | https://trackapi.nutritionix.com/v2/natural/nutrients | |
commentsCount | String-QUERY | users can look up the nutrition information for any branded food item api(GET) | https://trackapi.nutritionix.com/v2/search/item | |
Calculator | String-QUERY | nutrient calculator that can measure the dietary status of user |
SetUp help:https://stackoverflow.com/questions/24321165/make-rest-api-call-in-swift/46895243#46895243 , https://matteomanferdini.com/network-requests-rest-apis-ios-swift/ , https://medium.com/@nutanbhogendrasharma/consume-rest-api-in-swiftui-ios-mobile-app-b3c5d6ecf401