Skip to content

Bug Fixes and detail page implementation #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Mac OS X
.DS_Store

# Xcode
*.pbxuser
*.perspective
*.perspectivev3
*.mode1v3
*.mode2v3
*.xcuserstate
125 changes: 113 additions & 12 deletions codeChallenge.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
0745256A266A3BA800342E43 /* RestApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = 07452569266A3BA800342E43 /* RestApi.swift */; };
074C69BE266B40E700E82DBE /* CommonMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 074C69BD266B40E700E82DBE /* CommonMethods.m */; };
074C69C1266B568500E82DBE /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 074C69C0266B568500E82DBE /* .gitignore */; };
075989722668A309002129B1 /* PhotosModal.m in Sources */ = {isa = PBXBuildFile; fileRef = 075989712668A309002129B1 /* PhotosModal.m */; };
0764840C2668EDEB00022B6F /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0764840B2668EDEB00022B6F /* DetailViewController.m */; };
3E15BBE4208754FE0029597E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E15BBE3208754FE0029597E /* AppDelegate.m */; };
3E15BBE7208754FE0029597E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E15BBE6208754FE0029597E /* ViewController.m */; };
3E15BBE7208754FE0029597E /* FoodItemListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E15BBE6208754FE0029597E /* FoodItemListVC.m */; };
3E15BBEA208754FE0029597E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E15BBE8208754FE0029597E /* Main.storyboard */; };
3E15BBEC208754FE0029597E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3E15BBEB208754FE0029597E /* Assets.xcassets */; };
3E15BBEF208754FE0029597E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3E15BBED208754FE0029597E /* LaunchScreen.storyboard */; };
Expand All @@ -18,11 +23,22 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
07452568266A3BA800342E43 /* codeChallenge-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "codeChallenge-Bridging-Header.h"; sourceTree = "<group>"; };
07452569266A3BA800342E43 /* RestApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestApi.swift; sourceTree = "<group>"; };
074C69BC266B40E700E82DBE /* CommonMethods.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommonMethods.h; sourceTree = "<group>"; };
074C69BD266B40E700E82DBE /* CommonMethods.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CommonMethods.m; sourceTree = "<group>"; };
074C69C0266B568500E82DBE /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
0759896B26689E22002129B1 /* Constant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constant.h; sourceTree = "<group>"; };
075989702668A309002129B1 /* PhotosModal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhotosModal.h; sourceTree = "<group>"; };
075989712668A309002129B1 /* PhotosModal.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PhotosModal.m; sourceTree = "<group>"; };
076484072668C31600022B6F /* PrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = "<group>"; };
0764840A2668EDEB00022B6F /* DetailViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = "<group>"; };
0764840B2668EDEB00022B6F /* DetailViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = "<group>"; };
3E15BBDF208754FE0029597E /* codeChallenge.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = codeChallenge.app; sourceTree = BUILT_PRODUCTS_DIR; };
3E15BBE2208754FE0029597E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
3E15BBE3208754FE0029597E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
3E15BBE5208754FE0029597E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
3E15BBE6208754FE0029597E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
3E15BBE5208754FE0029597E /* FoodItemListVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FoodItemListVC.h; sourceTree = "<group>"; };
3E15BBE6208754FE0029597E /* FoodItemListVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FoodItemListVC.m; sourceTree = "<group>"; };
3E15BBE9208754FE0029597E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
3E15BBEB208754FE0029597E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
3E15BBEE208754FE0029597E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
Expand All @@ -44,9 +60,66 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
074C69C4266B73C800E82DBE /* Common */ = {
isa = PBXGroup;
children = (
0759896B26689E22002129B1 /* Constant.h */,
074C69BC266B40E700E82DBE /* CommonMethods.h */,
074C69BD266B40E700E82DBE /* CommonMethods.m */,
);
path = Common;
sourceTree = "<group>";
};
0759896626689B3B002129B1 /* ApiManager */ = {
isa = PBXGroup;
children = (
07452569266A3BA800342E43 /* RestApi.swift */,
);
path = ApiManager;
sourceTree = "<group>";
};
0759896D2668A13F002129B1 /* ViewControllers */ = {
isa = PBXGroup;
children = (
3E15BBE5208754FE0029597E /* FoodItemListVC.h */,
3E15BBE6208754FE0029597E /* FoodItemListVC.m */,
0764840A2668EDEB00022B6F /* DetailViewController.h */,
0764840B2668EDEB00022B6F /* DetailViewController.m */,
);
path = ViewControllers;
sourceTree = "<group>";
};
0759896E2668A170002129B1 /* Views */ = {
isa = PBXGroup;
children = (
3E15BBF8208774B10029597E /* CustomCell.h */,
3E15BBF9208774B10029597E /* CustomCell.m */,
3E15BBFB20879B4B0029597E /* CustomCell.xib */,
);
path = Views;
sourceTree = "<group>";
};
0759896F2668A1B1002129B1 /* Modal */ = {
isa = PBXGroup;
children = (
075989702668A309002129B1 /* PhotosModal.h */,
075989712668A309002129B1 /* PhotosModal.m */,
);
path = Modal;
sourceTree = "<group>";
};
076484062668C30A00022B6F /* PCH */ = {
isa = PBXGroup;
children = (
076484072668C31600022B6F /* PrefixHeader.pch */,
);
path = PCH;
sourceTree = "<group>";
};
3E15BBD6208754FE0029597E = {
isa = PBXGroup;
children = (
074C69C0266B568500E82DBE /* .gitignore */,
3E15BBE1208754FE0029597E /* codeChallenge */,
3E15BBE0208754FE0029597E /* Products */,
);
Expand All @@ -63,18 +136,20 @@
3E15BBE1208754FE0029597E /* codeChallenge */ = {
isa = PBXGroup;
children = (
074C69C4266B73C800E82DBE /* Common */,
076484062668C30A00022B6F /* PCH */,
0759896F2668A1B1002129B1 /* Modal */,
0759896626689B3B002129B1 /* ApiManager */,
0759896E2668A170002129B1 /* Views */,
0759896D2668A13F002129B1 /* ViewControllers */,
3E15BBE2208754FE0029597E /* AppDelegate.h */,
3E15BBE3208754FE0029597E /* AppDelegate.m */,
3E15BBE5208754FE0029597E /* ViewController.h */,
3E15BBE6208754FE0029597E /* ViewController.m */,
3E15BBF8208774B10029597E /* CustomCell.h */,
3E15BBF9208774B10029597E /* CustomCell.m */,
3E15BBFB20879B4B0029597E /* CustomCell.xib */,
3E15BBE8208754FE0029597E /* Main.storyboard */,
3E15BBEB208754FE0029597E /* Assets.xcassets */,
3E15BBED208754FE0029597E /* LaunchScreen.storyboard */,
3E15BBF0208754FE0029597E /* Info.plist */,
3E15BBF1208754FE0029597E /* main.m */,
07452568266A3BA800342E43 /* codeChallenge-Bridging-Header.h */,
);
path = codeChallenge;
sourceTree = "<group>";
Expand Down Expand Up @@ -105,11 +180,12 @@
3E15BBD7208754FE0029597E /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1210;
ORGANIZATIONNAME = "Fernando Suárez";
TargetAttributes = {
3E15BBDE208754FE0029597E = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 1210;
};
};
};
Expand All @@ -136,6 +212,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
074C69C1266B568500E82DBE /* .gitignore in Resources */,
3E15BBEF208754FE0029597E /* LaunchScreen.storyboard in Resources */,
3E15BBEC208754FE0029597E /* Assets.xcassets in Resources */,
3E15BBFC20879B4B0029597E /* CustomCell.xib in Resources */,
Expand All @@ -150,10 +227,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3E15BBE7208754FE0029597E /* ViewController.m in Sources */,
0745256A266A3BA800342E43 /* RestApi.swift in Sources */,
074C69BE266B40E700E82DBE /* CommonMethods.m in Sources */,
075989722668A309002129B1 /* PhotosModal.m in Sources */,
3E15BBE7208754FE0029597E /* FoodItemListVC.m in Sources */,
3E15BBF2208754FE0029597E /* main.m in Sources */,
3E15BBFA208774B10029597E /* CustomCell.m in Sources */,
3E15BBE4208754FE0029597E /* AppDelegate.m in Sources */,
0764840C2668EDEB00022B6F /* DetailViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -205,6 +286,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -214,12 +296,14 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEFINES_MODULE = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREFIX_HEADER = "/Users/asthayadav/Documents/Orderbird-coding-task/ios-tech-challenge/codeChallenge/PCH/PrefixHeader.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
Expand All @@ -230,9 +314,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.3;
IBC_MODULE = codeChallenge;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
PRODUCT_MODULE_NAME = codeChallenge;
SDKROOT = iphoneos;
};
name = Debug;
Expand Down Expand Up @@ -263,6 +349,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -272,19 +359,24 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREFIX_HEADER = "/Users/asthayadav/Documents/Orderbird-coding-task/ios-tech-challenge/codeChallenge/PCH/PrefixHeader.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.3;
IBC_MODULE = codeChallenge;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_MODULE_NAME = codeChallenge;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -293,7 +385,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 56ETNADXPZ;
INFOPLIST_FILE = codeChallenge/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -302,6 +396,9 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.nanosuarez.codeChallenge;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "codeChallenge/codeChallenge-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -310,7 +407,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 56ETNADXPZ;
INFOPLIST_FILE = codeChallenge/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -319,6 +418,8 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.nanosuarez.codeChallenge;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "codeChallenge/codeChallenge-Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "288A89BD-6985-4EB0-A92E-381CB046E958"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
<BreakpointContent
uuid = "DD25A74A-E348-4E41-9EE2-1435D52AB6C4"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
breakpointStackSelectionBehavior = "1"
scope = "1"
stopOnStyle = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>codeChallenge.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>3E15BBDE208754FE0029597E</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
55 changes: 55 additions & 0 deletions codeChallenge/ApiManager/RestApi.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// RestApi.swift
// codeChallenge
//
// Created by Astha yadav on 04/06/21.
// Copyright © 2021 Fernando Suárez. All rights reserved.
//

import Foundation
import UIKit

let FLICKR_APIKEY = "2ed35a9f4fda03bc96e73dbd03602780"
let BASEURL = "https://api.flickr.com/services/rest/"
let tags = "cooking"



class RestApi : NSObject {

static var sharedInstance:RestApi {
let instance = RestApi()
return instance
}

@objc func getFoodItemList(pageNo:Int,perPageCount:Int,sort:String){

let extra = "date_taken,views,description,date_upload,date_taken,owner_name,icon_server,original_format,last_update,views,media,url_t,url_l"

let requestParams = String(format: "method=flickr.photos.search&api_key=%@&tags=%@&page=%ld&per_page=%ld&format=json&nojsoncallback=1&sort=%@&extras=%@", FLICKR_APIKEY,tags,pageNo,perPageCount,sort,extra)

let completeUrlString = String(format: "%@?%@", BASEURL,requestParams)

let session = URLSession.shared
guard let url = URL(string: completeUrlString) else { return }
let task = session.dataTask(with: url, completionHandler: { data, response, error in
if error == nil {
do {
if let jsonData = data {
let json = try JSONSerialization.jsonObject(with: jsonData, options: []) as! [String: Any]

NotificationCenter.default.post(name: NSNotification.Name(rawValue: "getJSON"), object: self, userInfo: json)


}
} catch {
print(error.localizedDescription)
}
}else{
print(error?.localizedDescription ?? "Error")
}
})
task.resume()
}
}

Loading