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
25 changes: 25 additions & 0 deletions TalkinToTheNet/FourSquareSearchResult.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// FourSquareSearchResult.h
// TalkinToTheNet
//
// Created by Kaisha Jones on 9/25/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import <Foundation/Foundation.h>


@interface FourSquareSearchResult : NSObject


@property (nonatomic) NSString *barsName;

@property (nonatomic) NSString *barsAddress;

@property (nonatomic) NSString *barsPhoneNumber;

@property (nonatomic) NSString *barsDistance;

@property (nonatomic) NSString *barsSearchTerm;

@end
13 changes: 13 additions & 0 deletions TalkinToTheNet/FourSquareSearchResult.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// FourSquareSearchResult.m
// TalkinToTheNet
//
// Created by Kaisha Jones on 9/25/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import "FourSquareSearchResult.h"

@implementation FourSquareSearchResult

@end
25 changes: 25 additions & 0 deletions TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
8D7DCD541BAF859400A92AD2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D7DCD521BAF859400A92AD2 /* Main.storyboard */; };
8D7DCD561BAF859400A92AD2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D7DCD551BAF859400A92AD2 /* Assets.xcassets */; };
8D7DCD591BAF859400A92AD2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D7DCD571BAF859400A92AD2 /* LaunchScreen.storyboard */; };
A45248AC1BB629A000638D83 /* APIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A45248AB1BB629A000638D83 /* APIManager.m */; };
A45248AF1BB629FE00638D83 /* FourSquareSearchResult.m in Sources */ = {isa = PBXBuildFile; fileRef = A45248AE1BB629FE00638D83 /* FourSquareSearchResult.m */; };
A45248B21BB62C6700638D83 /* LocationFinderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A45248B11BB62C6700638D83 /* LocationFinderViewController.m */; };
A45248B51BB6302F00638D83 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A45248B41BB6302F00638D83 /* DetailViewController.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -26,6 +30,14 @@
8D7DCD551BAF859400A92AD2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8D7DCD581BAF859400A92AD2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
8D7DCD5A1BAF859400A92AD2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A45248AA1BB629A000638D83 /* APIManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIManager.h; sourceTree = "<group>"; };
A45248AB1BB629A000638D83 /* APIManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APIManager.m; sourceTree = "<group>"; };
A45248AD1BB629FE00638D83 /* FourSquareSearchResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FourSquareSearchResult.h; path = ../FourSquareSearchResult.h; sourceTree = "<group>"; };
A45248AE1BB629FE00638D83 /* FourSquareSearchResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FourSquareSearchResult.m; path = ../FourSquareSearchResult.m; sourceTree = "<group>"; };
A45248B01BB62C6700638D83 /* LocationFinderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocationFinderViewController.h; sourceTree = "<group>"; };
A45248B11BB62C6700638D83 /* LocationFinderViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LocationFinderViewController.m; sourceTree = "<group>"; };
A45248B31BB6302F00638D83 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = "<group>"; };
A45248B41BB6302F00638D83 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -58,8 +70,16 @@
8D7DCD481BAF859400A92AD2 /* TalkinToTheNet */ = {
isa = PBXGroup;
children = (
A45248AD1BB629FE00638D83 /* FourSquareSearchResult.h */,
A45248AE1BB629FE00638D83 /* FourSquareSearchResult.m */,
A45248B01BB62C6700638D83 /* LocationFinderViewController.h */,
A45248B11BB62C6700638D83 /* LocationFinderViewController.m */,
A45248B31BB6302F00638D83 /* DetailViewController.h */,
A45248B41BB6302F00638D83 /* DetailViewController.m */,
8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */,
8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */,
A45248AA1BB629A000638D83 /* APIManager.h */,
A45248AB1BB629A000638D83 /* APIManager.m */,
8D7DCD4F1BAF859400A92AD2 /* ViewController.h */,
8D7DCD501BAF859400A92AD2 /* ViewController.m */,
8D7DCD521BAF859400A92AD2 /* Main.storyboard */,
Expand Down Expand Up @@ -149,9 +169,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A45248AC1BB629A000638D83 /* APIManager.m in Sources */,
A45248B21BB62C6700638D83 /* LocationFinderViewController.m in Sources */,
8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */,
8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */,
8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */,
A45248AF1BB629FE00638D83 /* FourSquareSearchResult.m in Sources */,
A45248B51BB6302F00638D83 /* DetailViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -300,6 +324,7 @@
8D7DCD5F1BAF859400A92AD2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
21 changes: 21 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/APIManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// APIManager.h
// LearnAPI
//
// Created by Kaisha Jones on 9/20/15.
// Copyright © 2015 Kaisha Jones. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface APIManager : NSObject


// this is a public method

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

// completionHandler isEqualtoBlock I think, must adk mike ot google

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

#import "APIManager.h"

@implementation APIManager


// create a data task method. completely stateless, not going to maniupulate anything outside of it
// completion handler is the actual blokc that we are passing.

+ (void)GETRequestWithURL:(NSURL *)URL
// makes it a class method, we don't have to alloc init it
completionHandler:(void(^)(NSData *data, NSURLResponse *response, NSError *error)) completionHandler {

// this accesses the shared session

NSURLSession *session = [NSURLSession sharedSession];


// I think this creates a data task to execute a api request. By default this happens on a background thread
NSURLSessionDataTask *task = [session dataTaskWithURL:URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

NSLog(@"%@", data);
// this moves us back to the main thread
dispatch_async(dispatch_get_main_queue(), ^{
completionHandler(data, response, error);
});
}];
// this begins the task :)
[task resume];

}


@end
Loading