Skip to content

Commit e5926cb

Browse files
author
Todd Vanderlin
committed
ios tutorial
1 parent 65c80c9 commit e5926cb

File tree

91 files changed

+3619
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+3619
-0
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/bootstrap/compiled.php
2+
/vendor
3+
composer.phar
4+
composer.lock
5+
.env.*.php
6+
.env.php
7+
.DS_Store
8+
Thumbs.db

CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contribution Guidelines
2+
3+
Please submit all issues and pull requests to the [laravel/framework](http://github.com/laravel/framework) repository!

IOS/NoteApp.xcodeproj/project.pbxproj

+477
Large diffs are not rendered by default.

IOS/NoteApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "2.0">
5+
</Bucket>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0510"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "BAEEAECB193F6C680020E7F8"
18+
BuildableName = "NoteApp.app"
19+
BlueprintName = "NoteApp"
20+
ReferencedContainer = "container:NoteApp.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28+
shouldUseLaunchSchemeArgsEnv = "YES"
29+
buildConfiguration = "Debug">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "BAEEAEEC193F6C680020E7F8"
36+
BuildableName = "NoteAppTests.xctest"
37+
BlueprintName = "NoteAppTests"
38+
ReferencedContainer = "container:NoteApp.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "BAEEAECB193F6C680020E7F8"
46+
BuildableName = "NoteApp.app"
47+
BlueprintName = "NoteApp"
48+
ReferencedContainer = "container:NoteApp.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
</TestAction>
52+
<LaunchAction
53+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
54+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
55+
launchStyle = "0"
56+
useCustomWorkingDirectory = "NO"
57+
buildConfiguration = "Debug"
58+
ignoresPersistentStateOnLaunch = "NO"
59+
debugDocumentVersioning = "YES"
60+
allowLocationSimulation = "YES">
61+
<BuildableProductRunnable>
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "BAEEAECB193F6C680020E7F8"
65+
BuildableName = "NoteApp.app"
66+
BlueprintName = "NoteApp"
67+
ReferencedContainer = "container:NoteApp.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
<AdditionalOptions>
71+
</AdditionalOptions>
72+
</LaunchAction>
73+
<ProfileAction
74+
shouldUseLaunchSchemeArgsEnv = "YES"
75+
savedToolIdentifier = ""
76+
useCustomWorkingDirectory = "NO"
77+
buildConfiguration = "Release"
78+
debugDocumentVersioning = "YES">
79+
<BuildableProductRunnable>
80+
<BuildableReference
81+
BuildableIdentifier = "primary"
82+
BlueprintIdentifier = "BAEEAECB193F6C680020E7F8"
83+
BuildableName = "NoteApp.app"
84+
BlueprintName = "NoteApp"
85+
ReferencedContainer = "container:NoteApp.xcodeproj">
86+
</BuildableReference>
87+
</BuildableProductRunnable>
88+
</ProfileAction>
89+
<AnalyzeAction
90+
buildConfiguration = "Debug">
91+
</AnalyzeAction>
92+
<ArchiveAction
93+
buildConfiguration = "Release"
94+
revealArchiveInOrganizer = "YES">
95+
</ArchiveAction>
96+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>NoteApp.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>BAEEAECB193F6C680020E7F8</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>BAEEAEEC193F6C680020E7F8</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
</dict>
26+
</dict>
27+
</plist>

IOS/NoteApp/AppDelegate.h

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// AppDelegate.h
3+
// NoteApp
4+
//
5+
// Created by Todd Vanderlin on 6/4/14.
6+
// Copyright (c) 2014 IDEO. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#define BASE_URL @"http://laravelios:8888"
11+
12+
typedef void(^RequestBlock)(NSDictionary*data);
13+
14+
// -------------------------------------------------------------------
15+
@interface AppDelegate : UIResponder <UIApplicationDelegate>
16+
17+
@property (strong, nonatomic) UIWindow *window;
18+
19+
+(AppDelegate*)getInstance;
20+
-(void)makeRequest:(NSString*)urlString method:(NSString*)method params:(NSDictionary*)params onComplete:(RequestBlock)callback;
21+
@end

IOS/NoteApp/AppDelegate.m

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
//
2+
// AppDelegate.m
3+
// NoteApp
4+
//
5+
// Created by Todd Vanderlin on 6/4/14.
6+
// Copyright (c) 2014 IDEO. All rights reserved.
7+
//
8+
9+
#import "AppDelegate.h"
10+
11+
@implementation AppDelegate
12+
13+
14+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
15+
{
16+
17+
/*
18+
// Test the Request
19+
[self makeRequest:@"notes" params:nil method:@"GET" onComplete:^(NSDictionary *data) {
20+
NSLog(@"Json Loaded: %@", data);
21+
}];
22+
*/
23+
24+
// Override point for customization after application launch.
25+
return YES;
26+
}
27+
28+
- (void)applicationWillResignActive:(UIApplication *)application
29+
{
30+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
31+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
32+
}
33+
34+
- (void)applicationDidEnterBackground:(UIApplication *)application
35+
{
36+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
37+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
38+
}
39+
40+
- (void)applicationWillEnterForeground:(UIApplication *)application
41+
{
42+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
43+
}
44+
45+
- (void)applicationDidBecomeActive:(UIApplication *)application
46+
{
47+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
48+
}
49+
50+
- (void)applicationWillTerminate:(UIApplication *)application
51+
{
52+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
53+
}
54+
55+
// -------------------------------------------------------------------
56+
#pragma mark --- Singleton Instance ---
57+
// -------------------------------------------------------------------
58+
+(AppDelegate*)getInstance {
59+
return (AppDelegate*)[[UIApplication sharedApplication] delegate];
60+
}
61+
62+
// -------------------------------------------------------------------
63+
#pragma mark --- Request Notes Data ---
64+
// -------------------------------------------------------------------
65+
-(void)makeRequest:(NSString*)urlString method:(NSString*)method params:(NSDictionary*)params onComplete:(RequestBlock)callback {
66+
67+
// create the url
68+
NSURL * url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", BASE_URL, urlString]];
69+
NSMutableURLRequest * request = [[NSMutableURLRequest alloc] initWithURL:url];
70+
71+
// set the method (GET/POST/PUT/UPDATE/DELETE)
72+
[request setHTTPMethod:method];
73+
74+
// if we have params pull out the key/value and add to header
75+
if(params != nil) {
76+
NSMutableString * body = [[NSMutableString alloc] init];
77+
for (NSString * key in params.allKeys) {
78+
NSString * value = [params objectForKey:key];
79+
[body appendFormat:@"%@=%@&", key, value];
80+
}
81+
[request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
82+
}
83+
84+
// submit the request
85+
[NSURLConnection sendAsynchronousRequest:request
86+
queue:[NSOperationQueue mainQueue]
87+
completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
88+
89+
// do we have data?
90+
if(data && data.length > 0) {
91+
92+
NSDictionary * json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
93+
94+
// if we have a block lets pass it
95+
if(callback) {
96+
callback(json);
97+
}
98+
99+
}
100+
101+
}];
102+
103+
}
104+
105+
106+
@end
107+
108+
109+
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="a39-8H-nq0">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
5+
</dependencies>
6+
<scenes>
7+
<!--Notes Controller-->
8+
<scene sceneID="Emm-hB-rmt">
9+
<objects>
10+
<tableViewController id="hKl-Oz-hiM" customClass="NotesController" sceneMemberID="viewController">
11+
<tableView key="view" opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" id="Hv3-LG-wOx">
12+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
13+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
14+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
15+
<prototypes>
16+
<tableViewCell contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="5aP-36-Ncd">
17+
<rect key="frame" x="0.0" y="86" width="320" height="44"/>
18+
<autoresizingMask key="autoresizingMask"/>
19+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="5aP-36-Ncd" id="hp4-eF-cXg">
20+
<rect key="frame" x="0.0" y="0.0" width="320" height="43"/>
21+
<autoresizingMask key="autoresizingMask"/>
22+
</tableViewCellContentView>
23+
</tableViewCell>
24+
</prototypes>
25+
<connections>
26+
<outlet property="dataSource" destination="hKl-Oz-hiM" id="X9C-t7-nHP"/>
27+
<outlet property="delegate" destination="hKl-Oz-hiM" id="0gb-fX-9GP"/>
28+
</connections>
29+
</tableView>
30+
<navigationItem key="navigationItem" id="R1M-8T-yxP"/>
31+
</tableViewController>
32+
<placeholder placeholderIdentifier="IBFirstResponder" id="vmS-Td-bMP" userLabel="First Responder" sceneMemberID="firstResponder"/>
33+
</objects>
34+
<point key="canvasLocation" x="950" y="573"/>
35+
</scene>
36+
<!--Navigation Controller-->
37+
<scene sceneID="RPb-Pb-QtY">
38+
<objects>
39+
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="a39-8H-nq0" sceneMemberID="viewController">
40+
<toolbarItems/>
41+
<navigationBar key="navigationBar" contentMode="scaleToFill" id="6ON-DX-zSQ">
42+
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
43+
<autoresizingMask key="autoresizingMask"/>
44+
</navigationBar>
45+
<nil name="viewControllers"/>
46+
<connections>
47+
<segue destination="hKl-Oz-hiM" kind="relationship" relationship="rootViewController" id="0lH-YO-49a"/>
48+
</connections>
49+
</navigationController>
50+
<placeholder placeholderIdentifier="IBFirstResponder" id="JZX-aV-GLK" userLabel="First Responder" sceneMemberID="firstResponder"/>
51+
</objects>
52+
<point key="canvasLocation" x="424" y="573"/>
53+
</scene>
54+
</scenes>
55+
<simulatedMetricsContainer key="defaultSimulatedMetrics">
56+
<simulatedStatusBarMetrics key="statusBar"/>
57+
<simulatedOrientationMetrics key="orientation"/>
58+
<simulatedScreenMetrics key="destination" type="retina4"/>
59+
</simulatedMetricsContainer>
60+
</document>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "29x29",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "40x40",
11+
"scale" : "2x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "60x60",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"orientation" : "portrait",
5+
"idiom" : "iphone",
6+
"extent" : "full-screen",
7+
"minimum-system-version" : "7.0",
8+
"scale" : "2x"
9+
},
10+
{
11+
"orientation" : "portrait",
12+
"idiom" : "iphone",
13+
"subtype" : "retina4",
14+
"extent" : "full-screen",
15+
"minimum-system-version" : "7.0",
16+
"scale" : "2x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}

0 commit comments

Comments
 (0)