Skip to content
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
19 changes: 19 additions & 0 deletions TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
objects = {

/* Begin PBXBuildFile section */
4515B6571BB51038002461FA /* APIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4515B6561BB51038002461FA /* APIManager.m */; settings = {ASSET_TAGS = (); }; };
4515B65A1BB60AFB002461FA /* Place.m in Sources */ = {isa = PBXBuildFile; fileRef = 4515B6591BB60AFB002461FA /* Place.m */; settings = {ASSET_TAGS = (); }; };
4515B65D1BB61702002461FA /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4515B65C1BB61702002461FA /* DetailViewController.m */; settings = {ASSET_TAGS = (); }; };
8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD4A1BAF859400A92AD2 /* main.m */; };
8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */; };
8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD501BAF859400A92AD2 /* ViewController.m */; };
Expand All @@ -16,6 +19,12 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4515B6551BB51038002461FA /* APIManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIManager.h; sourceTree = "<group>"; };
4515B6561BB51038002461FA /* APIManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APIManager.m; sourceTree = "<group>"; };
4515B6581BB60AFB002461FA /* Place.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Place.h; sourceTree = "<group>"; };
4515B6591BB60AFB002461FA /* Place.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Place.m; sourceTree = "<group>"; };
4515B65B1BB61702002461FA /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = "<group>"; };
4515B65C1BB61702002461FA /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = "<group>"; };
8D7DCD461BAF859400A92AD2 /* TalkinToTheNet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TalkinToTheNet.app; sourceTree = BUILT_PRODUCTS_DIR; };
8D7DCD4A1BAF859400A92AD2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -60,8 +69,14 @@
children = (
8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */,
8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */,
4515B6551BB51038002461FA /* APIManager.h */,
4515B6561BB51038002461FA /* APIManager.m */,
4515B6581BB60AFB002461FA /* Place.h */,
4515B6591BB60AFB002461FA /* Place.m */,
8D7DCD4F1BAF859400A92AD2 /* ViewController.h */,
8D7DCD501BAF859400A92AD2 /* ViewController.m */,
4515B65B1BB61702002461FA /* DetailViewController.h */,
4515B65C1BB61702002461FA /* DetailViewController.m */,
8D7DCD521BAF859400A92AD2 /* Main.storyboard */,
8D7DCD551BAF859400A92AD2 /* Assets.xcassets */,
8D7DCD571BAF859400A92AD2 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -149,9 +164,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4515B65A1BB60AFB002461FA /* Place.m in Sources */,
4515B6571BB51038002461FA /* APIManager.m in Sources */,
8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */,
8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */,
8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */,
4515B65D1BB61702002461FA /* DetailViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -300,6 +318,7 @@
8D7DCD5F1BAF859400A92AD2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
17 changes: 17 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/APIManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// APIManager.h
// LearnAPI
//
// Created by Chris David on 9/20/15.
// Copyright © 2015 Chris David. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface APIManager : NSObject

+ (void)GETRequestWithURL:(NSURL *)URL
completionHandler:(void(^)(NSData *, NSURLResponse *, NSError *))
completionHandler;

@end
31 changes: 31 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/APIManager.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// APIManager.m
// LearnAPI
//
// Created by Chris David on 9/20/15.
// Copyright © 2015 Chris David. All rights reserved.
//

#import "APIManager.h"

@implementation APIManager

+ (void)GETRequestWithURL:(NSURL *)URL
completionHandler:(void(^)(NSData *, NSURLResponse *, NSError *))
completionHandler {

NSURLSession *session = [NSURLSession sharedSession];

//API Converted to task
NSURLSessionDataTask *task = [session dataTaskWithURL:URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(data, response, error);
});

}];

[task resume];

}
@end
Loading