diff --git a/TalkinToTheNet/.DS_Store b/TalkinToTheNet/.DS_Store new file mode 100644 index 0000000..5101eff Binary files /dev/null and b/TalkinToTheNet/.DS_Store differ diff --git a/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj b/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj index ee35a70..89fa233 100644 --- a/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj +++ b/TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj @@ -7,21 +7,50 @@ objects = { /* Begin PBXBuildFile section */ + 228221721BB8AC4A008900C2 /* DetailsTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 228221711BB8AC4A008900C2 /* DetailsTableViewCell.xib */; settings = {ASSET_TAGS = (); }; }; + 228221751BBAC25C008900C2 /* MapViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 228221741BBAC25C008900C2 /* MapViewController.m */; settings = {ASSET_TAGS = (); }; }; + 228221781BBB41A6008900C2 /* InstagramPost.m in Sources */ = {isa = PBXBuildFile; fileRef = 228221771BBB41A6008900C2 /* InstagramPost.m */; settings = {ASSET_TAGS = (); }; }; + 22D3D28D1BBF3E7D00E4B1A2 /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22D3D28C1BBF3E7D00E4B1A2 /* WebViewController.m */; settings = {ASSET_TAGS = (); }; }; + 22D3D28F1BBF5BDF00E4B1A2 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22D3D28E1BBF5BDF00E4B1A2 /* WebKit.framework */; }; + 22DE3DF11BB0379D00153600 /* APIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DE3DF01BB0379D00153600 /* APIManager.m */; settings = {ASSET_TAGS = (); }; }; + 22DE3DF31BB041A200153600 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22DE3DF21BB041A200153600 /* MapKit.framework */; }; + 22DE3DF51BB04E4300153600 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22DE3DF41BB04E4300153600 /* CoreLocation.framework */; }; + 22DE3DF81BB05AAD00153600 /* SearchViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DE3DF71BB05AAD00153600 /* SearchViewController.m */; settings = {ASSET_TAGS = (); }; }; + 22DE3E2A1BB4EA9B00153600 /* DetailsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DE3E291BB4EA9B00153600 /* DetailsTableViewController.m */; settings = {ASSET_TAGS = (); }; }; + 22DE3E2D1BB4EAD900153600 /* DetailsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DE3E2C1BB4EAD900153600 /* DetailsTableViewCell.m */; settings = {ASSET_TAGS = (); }; }; + 22DE3E321BB581E800153600 /* FourSquareVenueResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 22DE3E311BB581E800153600 /* FourSquareVenueResult.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 */; }; 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 */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 228221711BB8AC4A008900C2 /* DetailsTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DetailsTableViewCell.xib; sourceTree = ""; }; + 228221731BBAC25C008900C2 /* MapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapViewController.h; sourceTree = ""; }; + 228221741BBAC25C008900C2 /* MapViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MapViewController.m; sourceTree = ""; }; + 228221761BBB41A6008900C2 /* InstagramPost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstagramPost.h; sourceTree = ""; }; + 228221771BBB41A6008900C2 /* InstagramPost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InstagramPost.m; sourceTree = ""; }; + 22D3D28B1BBF3E7D00E4B1A2 /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewController.h; sourceTree = ""; }; + 22D3D28C1BBF3E7D00E4B1A2 /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewController.m; sourceTree = ""; }; + 22D3D28E1BBF5BDF00E4B1A2 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + 22DE3DEF1BB0379D00153600 /* APIManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIManager.h; sourceTree = ""; }; + 22DE3DF01BB0379D00153600 /* APIManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APIManager.m; sourceTree = ""; }; + 22DE3DF21BB041A200153600 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; + 22DE3DF41BB04E4300153600 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + 22DE3DF61BB05AAD00153600 /* SearchViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchViewController.h; sourceTree = ""; }; + 22DE3DF71BB05AAD00153600 /* SearchViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchViewController.m; sourceTree = ""; }; + 22DE3E281BB4EA9B00153600 /* DetailsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailsTableViewController.h; sourceTree = ""; }; + 22DE3E291BB4EA9B00153600 /* DetailsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailsTableViewController.m; sourceTree = ""; }; + 22DE3E2B1BB4EAD900153600 /* DetailsTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailsTableViewCell.h; sourceTree = ""; }; + 22DE3E2C1BB4EAD900153600 /* DetailsTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailsTableViewCell.m; sourceTree = ""; }; + 22DE3E301BB581E800153600 /* FourSquareVenueResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FourSquareVenueResult.h; sourceTree = ""; }; + 22DE3E311BB581E800153600 /* FourSquareVenueResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FourSquareVenueResult.m; sourceTree = ""; }; 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 = ""; }; 8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8D7DCD4F1BAF859400A92AD2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8D7DCD501BAF859400A92AD2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 8D7DCD531BAF859400A92AD2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 8D7DCD551BAF859400A92AD2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 8D7DCD581BAF859400A92AD2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -33,6 +62,9 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 22D3D28F1BBF5BDF00E4B1A2 /* WebKit.framework in Frameworks */, + 22DE3DF51BB04E4300153600 /* CoreLocation.framework in Frameworks */, + 22DE3DF31BB041A200153600 /* MapKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -42,6 +74,9 @@ 8D7DCD3D1BAF859400A92AD2 = { isa = PBXGroup; children = ( + 22D3D28E1BBF5BDF00E4B1A2 /* WebKit.framework */, + 22DE3DF41BB04E4300153600 /* CoreLocation.framework */, + 22DE3DF21BB041A200153600 /* MapKit.framework */, 8D7DCD481BAF859400A92AD2 /* TalkinToTheNet */, 8D7DCD471BAF859400A92AD2 /* Products */, ); @@ -60,8 +95,23 @@ children = ( 8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */, 8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */, - 8D7DCD4F1BAF859400A92AD2 /* ViewController.h */, - 8D7DCD501BAF859400A92AD2 /* ViewController.m */, + 22DE3DEF1BB0379D00153600 /* APIManager.h */, + 22DE3DF01BB0379D00153600 /* APIManager.m */, + 22DE3DF61BB05AAD00153600 /* SearchViewController.h */, + 22DE3DF71BB05AAD00153600 /* SearchViewController.m */, + 228221731BBAC25C008900C2 /* MapViewController.h */, + 228221741BBAC25C008900C2 /* MapViewController.m */, + 22DE3E301BB581E800153600 /* FourSquareVenueResult.h */, + 22DE3E311BB581E800153600 /* FourSquareVenueResult.m */, + 22DE3E281BB4EA9B00153600 /* DetailsTableViewController.h */, + 22DE3E291BB4EA9B00153600 /* DetailsTableViewController.m */, + 22D3D28B1BBF3E7D00E4B1A2 /* WebViewController.h */, + 22D3D28C1BBF3E7D00E4B1A2 /* WebViewController.m */, + 228221761BBB41A6008900C2 /* InstagramPost.h */, + 228221771BBB41A6008900C2 /* InstagramPost.m */, + 22DE3E2B1BB4EAD900153600 /* DetailsTableViewCell.h */, + 22DE3E2C1BB4EAD900153600 /* DetailsTableViewCell.m */, + 228221711BB8AC4A008900C2 /* DetailsTableViewCell.xib */, 8D7DCD521BAF859400A92AD2 /* Main.storyboard */, 8D7DCD551BAF859400A92AD2 /* Assets.xcassets */, 8D7DCD571BAF859400A92AD2 /* LaunchScreen.storyboard */, @@ -110,6 +160,7 @@ TargetAttributes = { 8D7DCD451BAF859400A92AD2 = { CreatedOnToolsVersion = 7.0; + DevelopmentTeam = N2DCZ2U592; }; }; }; @@ -138,6 +189,7 @@ files = ( 8D7DCD591BAF859400A92AD2 /* LaunchScreen.storyboard in Resources */, 8D7DCD561BAF859400A92AD2 /* Assets.xcassets in Resources */, + 228221721BB8AC4A008900C2 /* DetailsTableViewCell.xib in Resources */, 8D7DCD541BAF859400A92AD2 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -149,8 +201,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */, + 22DE3E2D1BB4EAD900153600 /* DetailsTableViewCell.m in Sources */, + 22D3D28D1BBF3E7D00E4B1A2 /* WebViewController.m in Sources */, + 22DE3DF11BB0379D00153600 /* APIManager.m in Sources */, + 22DE3E2A1BB4EA9B00153600 /* DetailsTableViewController.m in Sources */, + 228221751BBAC25C008900C2 /* MapViewController.m in Sources */, 8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */, + 22DE3DF81BB05AAD00153600 /* SearchViewController.m in Sources */, + 22DE3E321BB581E800153600 /* FourSquareVenueResult.m in Sources */, + 228221781BBB41A6008900C2 /* InstagramPost.m in Sources */, 8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -261,11 +320,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = TalkinToTheNet/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.TalkinToTheNet; + PRODUCT_BUNDLE_IDENTIFIER = com.danieldistant.TalkinToTheNet; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Debug; }; @@ -273,11 +335,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = TalkinToTheNet/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.4; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.mikekavouras.TalkinToTheNet; + PRODUCT_BUNDLE_IDENTIFIER = com.danieldistant.TalkinToTheNet; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = ""; }; name = Release; }; @@ -300,6 +365,7 @@ 8D7DCD5F1BAF859400A92AD2 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/TalkinToTheNet/TalkinToTheNet/APIManager.h b/TalkinToTheNet/TalkinToTheNet/APIManager.h new file mode 100644 index 0000000..90fd02d --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/APIManager.h @@ -0,0 +1,15 @@ +// +// APIManager.h +// LearnAPIs2 +// +// Created by Daniel Distant on 9/20/15. +// Copyright © 2015 ddistant. All rights reserved. +// + +#import + +@interface APIManager : NSObject + ++(void)GETRequestWithURL:(NSURL *)URL completionHandler:(void(^)(NSData *, NSURLResponse *, NSError *))completionHandler; + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/APIManager.m b/TalkinToTheNet/TalkinToTheNet/APIManager.m new file mode 100644 index 0000000..d4b8641 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/APIManager.m @@ -0,0 +1,30 @@ +// +// APIManager.m +// LearnAPIs2 +// +// Created by Daniel Distant on 9/20/15. +// Copyright © 2015 ddistant. All rights reserved. +// + +#import "APIManager.h" + +@implementation APIManager + ++ (void)GETRequestWithURL:(NSURL *)URL completionHandler:(void(^)(NSData *, NSURLResponse *, NSError *))completionHandler { + + NSURLSession *session = [NSURLSession sharedSession]; + + NSURLSessionDataTask *task = [session dataTaskWithURL:URL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + + dispatch_async(dispatch_get_main_queue(), ^{ + + completionHandler(data, response,error); + }); + + }]; + + [task resume]; + +} + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/Contents.json b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/foursquare logo.imageset/Contents.json b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/foursquare logo.imageset/Contents.json new file mode 100644 index 0000000..c686437 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/foursquare logo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "foursquare logo.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/foursquare logo.imageset/foursquare logo.png b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/foursquare logo.imageset/foursquare logo.png new file mode 100644 index 0000000..bb0f268 Binary files /dev/null and b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/foursquare logo.imageset/foursquare logo.png differ diff --git a/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/nearMeLogo.imageset/Contents.json b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/nearMeLogo.imageset/Contents.json new file mode 100644 index 0000000..32157dc --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/nearMeLogo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "nearMeLogo.jpeg", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/nearMeLogo.imageset/nearMeLogo.jpeg b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/nearMeLogo.imageset/nearMeLogo.jpeg new file mode 100644 index 0000000..6e5fce6 Binary files /dev/null and b/TalkinToTheNet/TalkinToTheNet/Assets.xcassets/nearMeLogo.imageset/nearMeLogo.jpeg differ diff --git a/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard b/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard index 2e721e1..e5e98ce 100644 --- a/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard +++ b/TalkinToTheNet/TalkinToTheNet/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,14 @@ - + - + + + + + HelveticaNeue-Thin + + @@ -15,8 +21,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + @@ -24,4 +73,7 @@ + + + diff --git a/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard b/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard index f56d2f3..3d37289 100644 --- a/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard +++ b/TalkinToTheNet/TalkinToTheNet/Base.lproj/Main.storyboard @@ -1,25 +1,327 @@ - + - + + + + + HelveticaNeue-Thin + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.h b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.h new file mode 100644 index 0000000..09b22aa --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.h @@ -0,0 +1,20 @@ +// +// DetailsTableViewCell.h +// TalkinToTheNet +// +// Created by Daniel Distant on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface DetailsTableViewCell : UITableViewCell + +@property (weak, nonatomic) IBOutlet UILabel *nameLabel; +@property (weak, nonatomic) IBOutlet UILabel *phoneLabel; +@property (weak, nonatomic) IBOutlet UILabel *addressLabel; +@property (weak, nonatomic) IBOutlet UILabel *mobileLabel; +@property (weak, nonatomic) IBOutlet UIImageView *InstagramImageView; + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.m b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.m new file mode 100644 index 0000000..3ad0609 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.m @@ -0,0 +1,23 @@ +// +// DetailsTableViewCell.m +// TalkinToTheNet +// +// Created by Daniel Distant on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "DetailsTableViewCell.h" + +@implementation DetailsTableViewCell + +- (void)awakeFromNib { + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.xib b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.xib new file mode 100644 index 0000000..21fc057 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewCell.xib @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/TalkinToTheNet/TalkinToTheNet/DetailsTableViewController.h b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewController.h new file mode 100644 index 0000000..b6d64fe --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewController.h @@ -0,0 +1,16 @@ +// +// DetailsTableViewController.h +// TalkinToTheNet +// +// Created by Daniel Distant on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface DetailsTableViewController : UITableViewController + +@property (nonatomic) NSString *searchTerm; +@property (nonatomic) NSMutableArray *searchResults; + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/DetailsTableViewController.m b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewController.m new file mode 100644 index 0000000..5d193c7 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/DetailsTableViewController.m @@ -0,0 +1,122 @@ +// +// DetailsTableViewController.m +// TalkinToTheNet +// +// Created by Daniel Distant on 9/24/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "DetailsTableViewController.h" +#import "DetailsTableViewCell.h" +#import "APIManager.h" +#import "InstagramPost.h" + +@interface DetailsTableViewController () + +@end + +@implementation DetailsTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self setup]; + [self fetchInstagramData]; +} + +-(void) setup { + + //'no search results' alert + + self.searchResults = [[NSMutableArray alloc] init]; + + //custom cells + + self.tableView.rowHeight = UITableViewAutomaticDimension; + self.tableView.estimatedRowHeight = 12.0; + + [self.tableView registerNib:[UINib nibWithNibName:@"DetailsTableViewCell" bundle:nil] forCellReuseIdentifier:@"DetailsTableViewCell"]; + + //pull to refresh + self.refreshControl = [[UIRefreshControl alloc] init]; + [self.refreshControl addTarget:self action:@selector(pulledToRefresh:) forControlEvents:UIControlEventValueChanged]; + + //title + self.navigationItem.title = @"Photos"; + +} + +- (void) fetchInstagramData { + + NSString *urlString = [NSString stringWithFormat: @"https://api.instagram.com/v1/tags/%@/media/recent?client_id=ac0ee52ebb154199bfabfb15b498c067", self.searchTerm]; + + NSString *encodedString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + + NSURL *url = [NSURL URLWithString:encodedString]; + + [APIManager GETRequestWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + + if (data != nil) { + NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; + + NSArray *results = json[@"data"]; + + self.searchResults = [[NSMutableArray alloc] init]; + + for (NSDictionary *result in results) { + InstagramPost *post = [[InstagramPost alloc] initWithJSON:result]; + [self.searchResults addObject:post]; + } + + if (self.searchResults.count == 0) { + [self createAlertWithTitle:@"Search Error" andMessage:@"No pictures found!"]; + } + [self.tableView reloadData]; + } + }]; + +} + +-(void)pulledToRefresh:(UIRefreshControl *)sender { + [self fetchInstagramData]; + [sender endRefreshing]; +} + +- (void) createAlertWithTitle:(NSString *)title andMessage:(NSString *)message { + UIAlertController* alert = [UIAlertController alertControllerWithTitle:title + message:message + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) {}]; + + [alert addAction:defaultAction]; + [self presentViewController:alert animated:YES completion:nil]; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.searchResults.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"InstagramCellIdentifier" forIndexPath:indexPath]; + + InstagramPost *post = self.searchResults[indexPath.row]; + cell.textLabel.text = post.username; + cell.detailTextLabel.text = post.caption; + NSURL *imageURL = [NSURL URLWithString:post.imageURLString]; + NSData *imageData = [NSData dataWithContentsOfURL:imageURL]; + cell.imageView.image = [UIImage imageWithData:imageData]; + + return cell; +} + + + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/FourSquareVenueResult.h b/TalkinToTheNet/TalkinToTheNet/FourSquareVenueResult.h new file mode 100644 index 0000000..8384640 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/FourSquareVenueResult.h @@ -0,0 +1,23 @@ +// +// FourSquareVenueResult.h +// TalkinToTheNet +// +// Created by Daniel Distant on 9/25/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface FourSquareVenueResult : NSObject + +@property (nonatomic) NSString *name; +@property (nonatomic) NSString *phoneNumber; +@property (nonatomic) NSNumber *latitude; +@property (nonatomic) NSNumber *longitude; +@property (nonatomic) NSString *address; +@property (nonatomic) NSNumber *distance; +@property (nonatomic) NSURL *mobileURL; + +-(instancetype)initWithJSON:(NSDictionary *)json; + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/FourSquareVenueResult.m b/TalkinToTheNet/TalkinToTheNet/FourSquareVenueResult.m new file mode 100644 index 0000000..f52b248 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/FourSquareVenueResult.m @@ -0,0 +1,23 @@ +// +// FourSquareVenueResult.m +// TalkinToTheNet +// +// Created by Daniel Distant on 9/25/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "FourSquareVenueResult.h" + +@implementation FourSquareVenueResult + +-(instancetype)initWithJSON:(NSDictionary *)json { + + //you always need this to overwrite an initializer + + if (self = [super init]) { + return self; + } + return nil; +} + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/Info.plist b/TalkinToTheNet/TalkinToTheNet/Info.plist index 6905cc6..b10aeb5 100644 --- a/TalkinToTheNet/TalkinToTheNet/Info.plist +++ b/TalkinToTheNet/TalkinToTheNet/Info.plist @@ -2,6 +2,13 @@ + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + CFBundleDisplayName + NSAppTransportSecurity CFBundleDevelopmentRegion en CFBundleExecutable @@ -20,6 +27,10 @@ ???? CFBundleVersion 1 + NSLocationWhenInUseUsageDescription + Location permission required + NSLocationUsageDescription + Location permission required LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/TalkinToTheNet/TalkinToTheNet/InstagramPost.h b/TalkinToTheNet/TalkinToTheNet/InstagramPost.h new file mode 100644 index 0000000..936b88f --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/InstagramPost.h @@ -0,0 +1,19 @@ +// +// InstagramPost.h +// TalkinToTheNet +// +// Created by Daniel Distant on 9/29/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface InstagramPost : NSObject + +@property (nonatomic) NSString *imageURLString; +@property (nonatomic) NSString *username; +@property (nonatomic) NSString *caption; + +-(instancetype) initWithJSON:(NSDictionary *)json; + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/InstagramPost.m b/TalkinToTheNet/TalkinToTheNet/InstagramPost.m new file mode 100644 index 0000000..c404a86 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/InstagramPost.m @@ -0,0 +1,26 @@ +// +// InstagramPost.m +// TalkinToTheNet +// +// Created by Daniel Distant on 9/29/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "InstagramPost.h" + +@implementation InstagramPost + +-(instancetype) initWithJSON:(NSDictionary *)json { + + if (self = [super init]) { + + self.caption = json[@"caption"][@"text"]; + self.username = json[@"user"][@"username"]; + self.imageURLString = json[@"images"][@"standard_resolution"][@"url"]; + + return self; + } + return nil; +} + +@end \ No newline at end of file diff --git a/TalkinToTheNet/TalkinToTheNet/MapViewController.h b/TalkinToTheNet/TalkinToTheNet/MapViewController.h new file mode 100644 index 0000000..0756e2a --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/MapViewController.h @@ -0,0 +1,27 @@ +// +// MapViewController.h +// TalkinToTheNet +// +// Created by Daniel Distant on 9/29/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import +#import + + +@interface MapViewController : UIViewController + +@property (weak, nonatomic) IBOutlet UILabel *nameLabel; +@property (weak, nonatomic) IBOutlet UIButton *mobileButton; +@property (weak, nonatomic) IBOutlet UILabel *phoneNumberLabel; +@property (weak, nonatomic) IBOutlet UILabel *addressLabel; +@property (nonatomic) double userLatitude; //user location +@property (nonatomic) double userLongitude; //user location +@property (weak, nonatomic) IBOutlet MKMapView *locatorMapView; +@property (nonatomic) NSMutableDictionary *venueResultInfo; + + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/MapViewController.m b/TalkinToTheNet/TalkinToTheNet/MapViewController.m new file mode 100644 index 0000000..39535f0 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/MapViewController.m @@ -0,0 +1,123 @@ +// +// MapViewController.m +// TalkinToTheNet +// +// Created by Daniel Distant on 9/29/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "MapViewController.h" +#import "DetailsTableViewController.h" +#import "WebViewController.h" + +@interface MapViewController () + +@end + +@implementation MapViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + [self setup]; + [self setLabels]; + [self updateMap]; + +} + +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + + if ([segue.identifier isEqualToString:@"photoSegue"]) { + + DetailsTableViewController *viewController = [segue destinationViewController]; + if (self.venueResultInfo[@"name"] != nil) { + viewController.searchTerm = self.venueResultInfo[@"name"]; + } + } + + if ([segue.identifier isEqualToString:@"webSegue"]) { + + WebViewController *viewController = [segue destinationViewController]; + viewController.url = [NSURL URLWithString:[self.venueResultInfo objectForKey: @"mobileURL"]]; + + } +} +-(void) setup { + + self.navigationItem.title = @"Location"; + + //mapview + + self.locatorMapView.delegate = self; + + CLLocationCoordinate2D center = CLLocationCoordinate2DMake(self.userLatitude,self.userLongitude); + MKCoordinateSpan span = MKCoordinateSpanMake(0.5, 0.5); + + [self.locatorMapView setRegion:MKCoordinateRegionMake(center, span) animated:YES]; + + self.locatorMapView.layer.borderWidth = 2.0; + self.locatorMapView.layer.borderColor = [UIColor colorWithRed:40/255.0 green:80/255.0 blue:131/255.0 alpha:1].CGColor; + self.locatorMapView.layer.cornerRadius = 10.0; + + //mobileButton + + self.mobileButton.titleLabel.textAlignment = NSTextAlignmentLeft; + +} + +-(void) setLabels { + + if (self.venueResultInfo[@"name"] == nil) { + self.nameLabel.text = @"n/a"; + } else { + + self.nameLabel.text = [self.venueResultInfo objectForKey:@"name"]; + } + + if (self.venueResultInfo[@"mobileURL"] == nil) { + self.mobileButton.hidden = YES; + } else { + + [self.mobileButton setTitle:@"Website" forState:UIControlStateNormal]; + + } + + if (self.venueResultInfo[@"address"] == nil) { + self.addressLabel.text = @"n/a"; + } else { + + self.addressLabel.text = [[self.venueResultInfo objectForKey: @"address"] componentsJoinedByString:@" "]; + } + + if (self.venueResultInfo[@"phoneNumber"] == nil) { + self.phoneNumberLabel.text = @"n/a"; + } else { + + self.phoneNumberLabel.text = [self.venueResultInfo objectForKey: @"phoneNumber"]; + } + +} + +-(void) addAnnotationForVenue { + + MKPointAnnotation *mapPin = [[MKPointAnnotation alloc] init]; + + double lat = [self.venueResultInfo[@"latitude"] doubleValue]; + double lng = [self.venueResultInfo[@"longitude"] doubleValue]; + + CLLocationCoordinate2D venueLocation = CLLocationCoordinate2DMake(lat, lng); + + mapPin.coordinate = venueLocation; + mapPin.title = self.venueResultInfo[@"name"]; + + [self.locatorMapView addAnnotation:mapPin]; +} + +-(void) updateMap { + [self.locatorMapView removeAnnotations:self.locatorMapView.annotations]; + + [self addAnnotationForVenue]; + +} + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/SearchViewController.h b/TalkinToTheNet/TalkinToTheNet/SearchViewController.h new file mode 100644 index 0000000..25a97cf --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/SearchViewController.h @@ -0,0 +1,26 @@ +// +// SearchViewController.h +// TalkinToTheNet +// +// Created by Daniel Distant on 9/21/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import +#import +#import +#import "APIManager.h" + + +@interface SearchViewController : UIViewController +< +UITextFieldDelegate, +UITableViewDataSource, +UITableViewDelegate, +CLLocationManagerDelegate +> + +@property (weak, nonatomic) IBOutlet UITableView *tableView; +@property (nonatomic) NSMutableArray *searchResults; + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/SearchViewController.m b/TalkinToTheNet/TalkinToTheNet/SearchViewController.m new file mode 100644 index 0000000..5d9eddf --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/SearchViewController.m @@ -0,0 +1,214 @@ +// +// SearchViewController.m +// TalkinToTheNet +// +// Created by Daniel Distant on 9/21/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "SearchViewController.h" +#import "FourSquareVenueResult.h" +#import "DetailsTableViewController.h" +#import "MapViewController.h" + + + +@interface SearchViewController () + +//@property (nonatomic) IBOutlet MKMapView *searchMapView; + +@property (weak, nonatomic) IBOutlet UITextField *searchTextField; +@property (weak, nonatomic) IBOutlet UILabel *searchLabel1; +@property (weak, nonatomic) IBOutlet UILabel *searchLabel2; +@property (nonatomic) CLLocationManager *locationManager; + + +@end +@implementation SearchViewController + +- (void)viewDidLoad { + + [self setup]; + +} + +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + + if ([segue.identifier isEqualToString:@"MapSegue"]) { + + MapViewController *viewController = [segue destinationViewController]; + NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + FourSquareVenueResult *currentResult = [self.searchResults objectAtIndex:indexPath.row]; + NSMutableDictionary *currentDictionary = [[NSMutableDictionary alloc] init]; + [currentDictionary setObject:currentResult.name forKey:@"name"]; + [currentDictionary setObject:currentResult.address forKey:@"address"]; + [currentDictionary setObject:currentResult.latitude forKey:@"latitude"]; + [currentDictionary setObject:currentResult.longitude forKey:@"longitude"]; + + if (currentResult.phoneNumber == nil) { + [currentDictionary setObject:@"n/a" forKey:@"phoneNumber"]; + } else { + [currentDictionary setObject:currentResult.phoneNumber forKey:@"phoneNumber"]; + } + + [currentDictionary setObject: [NSString stringWithFormat:@"%@", currentResult.mobileURL] forKey:@"mobileURL"]; + viewController.venueResultInfo = [[NSMutableDictionary alloc] init]; + [viewController.venueResultInfo addEntriesFromDictionary:currentDictionary]; + + //user location + + viewController.userLatitude = self.locationManager.location.coordinate.latitude; + viewController.userLongitude = self.locationManager.location.coordinate.longitude; + + } +} + +-(void) setup { + + //array + + self.searchResults = [[NSMutableArray alloc] init]; + + //textfield + + self.searchTextField.delegate = self; + + //tableview + + self.tableView.delegate = self; + self.tableView.dataSource = self; + + //UI + + self.navigationItem.title = @"Search"; + + + self.searchTextField.layer.borderWidth = 3.0; + self.searchTextField.layer.borderColor = [UIColor colorWithRed:40/255.0 green:80/255.0 blue:131/255.0 alpha:1].CGColor; + self.searchTextField.layer.cornerRadius = 10.0; + + self.tableView.layer.borderWidth = 2.0; + self.tableView.layer.borderColor = [UIColor colorWithRed:40/255.0 green:80/255.0 blue:131/255.0 alpha:1].CGColor; + self.tableView.layer.cornerRadius = 10.0; + + self.searchLabel1.textColor = [UIColor colorWithRed:249/255.0 green:72/255.0 blue:119/255.0 alpha:1]; + self.searchLabel2.textColor = [UIColor colorWithRed:249/255.0 green:72/255.0 blue:119/255.0 alpha:1]; + + //locationManager + + self.locationManager = [[CLLocationManager alloc] init]; + + self.locationManager.delegate = self; + + if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { + [self.locationManager requestWhenInUseAuthorization]; + [self.locationManager startUpdatingLocation]; + } +} + + +-(void) makeNewFourSquareRequestWithSearchTerm:(NSString *)searchTerm + callBackBlock:(void(^)())block { + + if (self.searchResults.count > 0) { + [self.searchResults removeAllObjects]; + } + + NSString *urlString = [NSString stringWithFormat:@"https://api.foursquare.com/v2/venues/explore?client_id=4BVIIF5WI4YYPWT0O1MANDN4QJ1GLCHDCESZZZP1RHJIR0DQ&client_secret=QHR4C1IDZSWUFTD3DOO2TOJ05IXO1D1SMK4IGEOC3AKRB1FN&v=20140806&ll=%f,%f&query=%@", self.locationManager.location.coordinate.latitude, self.locationManager.location.coordinate.longitude, self.searchTextField.text]; + + NSString *encodedString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; + + NSURL *url = [NSURL URLWithString:encodedString]; + + [APIManager GETRequestWithURL:url completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { + + if (data != nil) { + + NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; + + NSArray *results = json[@"response"][@"groups"][0][@"items"]; + + for (NSDictionary *result in results) { + + FourSquareVenueResult *venueResult = [[FourSquareVenueResult alloc] initWithJSON:result]; + + venueResult.name = result[@"venue"][@"name"]; + venueResult.phoneNumber = result[@"venue"][@"contact"][@"formattedPhone"]; + venueResult.address = result[@"venue"][@"location"][@"formattedAddress"]; + venueResult.distance = result[@"venue"][@"location"][@"distance"]; + venueResult.mobileURL = result[@"venue"][@"menu"][@"mobileUrl"]; + venueResult.latitude = result[@"venue"][@"location"][@"lat"]; + venueResult.longitude = result[@"venue"][@"location"][@"lng"]; + + [self.searchResults addObject:venueResult]; + + } + } + + if (self.searchResults.count == 0) { + [self createAlertWithTitle:@"Search Error" andMessage:@"No results found!"]; + } + + block(); + }]; + +} + + +#pragma mark - text field + +-(BOOL)textFieldShouldReturn:(UITextField *)textField { + + //dismiss keyboard + [self.view endEditing:YES]; + + if ([textField.text isEqualToString:@""]) { + [self createAlertWithTitle:@"Search term required" andMessage:@"What are you looking for?"]; + } + + //make API request + [self makeNewFourSquareRequestWithSearchTerm:textField.text callBackBlock:^{ + [self.tableView reloadData]; + }]; + + return YES; +} + +#pragma mark -table view + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.searchResults.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellIdentifier" forIndexPath:indexPath]; + + FourSquareVenueResult *venueResult = self.searchResults[indexPath.row]; + + cell.textLabel.text = venueResult.name; + cell.detailTextLabel.text = venueResult.phoneNumber; + + return cell; + +} + +- (void) createAlertWithTitle:(NSString *)title andMessage:(NSString *)message { + UIAlertController* alert = [UIAlertController alertControllerWithTitle:title + message:message + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault + handler:^(UIAlertAction * action) {}]; + + [alert addAction:defaultAction]; + [self presentViewController:alert animated:YES completion:nil]; +} + + + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/ViewController.h b/TalkinToTheNet/TalkinToTheNet/ViewController.h deleted file mode 100644 index 8113a85..0000000 --- a/TalkinToTheNet/TalkinToTheNet/ViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ViewController.h -// TalkinToTheNet -// -// Created by Michael Kavouras on 9/20/15. -// Copyright © 2015 Mike Kavouras. All rights reserved. -// - -#import - -@interface ViewController : UIViewController - - -@end - diff --git a/TalkinToTheNet/TalkinToTheNet/ViewController.m b/TalkinToTheNet/TalkinToTheNet/ViewController.m deleted file mode 100644 index cbefa29..0000000 --- a/TalkinToTheNet/TalkinToTheNet/ViewController.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// ViewController.m -// TalkinToTheNet -// -// Created by Michael Kavouras on 9/20/15. -// Copyright © 2015 Mike Kavouras. All rights reserved. -// - -#import "ViewController.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -@end diff --git a/TalkinToTheNet/TalkinToTheNet/WebViewController.h b/TalkinToTheNet/TalkinToTheNet/WebViewController.h new file mode 100644 index 0000000..7746970 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/WebViewController.h @@ -0,0 +1,15 @@ +// +// WebViewController.h +// TalkinToTheNet +// +// Created by Daniel Distant on 10/2/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import + +@interface WebViewController : UIViewController + +@property (nonatomic) NSURL *url; + +@end diff --git a/TalkinToTheNet/TalkinToTheNet/WebViewController.m b/TalkinToTheNet/TalkinToTheNet/WebViewController.m new file mode 100644 index 0000000..021d800 --- /dev/null +++ b/TalkinToTheNet/TalkinToTheNet/WebViewController.m @@ -0,0 +1,29 @@ +// +// WebViewController.m +// TalkinToTheNet +// +// Created by Daniel Distant on 10/2/15. +// Copyright © 2015 Mike Kavouras. All rights reserved. +// + +#import "WebViewController.h" +#import + +@interface WebViewController () +@property (weak, nonatomic) IBOutlet UIWebView *webView; + +@end + +@implementation WebViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.webView.delegate = self; + + self.navigationItem.title = @"Website"; + + [self.webView loadRequest: [NSURLRequest requestWithURL:self.url]]; +} + +@end