Skip to content

Commit 0f3a4a0

Browse files
committed
IOS9ReorderingCollectionViewTutorial added
1 parent b54fb3c commit 0f3a4a0

File tree

18 files changed

+1087
-0
lines changed

18 files changed

+1087
-0
lines changed

IOS9ReorderingCollectionViewTutorial/IOS9ReorderingCollectionViewTutorial.xcodeproj/project.pbxproj

Lines changed: 508 additions & 0 deletions
Large diffs are not rendered by default.

IOS9ReorderingCollectionViewTutorial/IOS9ReorderingCollectionViewTutorial.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
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,111 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0700"
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 = "E25525C21BA961DC00CA18DB"
18+
BuildableName = "IOS9ReorderingCollectionViewTutorial.app"
19+
BlueprintName = "IOS9ReorderingCollectionViewTutorial"
20+
ReferencedContainer = "container:IOS9ReorderingCollectionViewTutorial.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "E25525D61BA961DC00CA18DB"
36+
BuildableName = "IOS9ReorderingCollectionViewTutorialTests.xctest"
37+
BlueprintName = "IOS9ReorderingCollectionViewTutorialTests"
38+
ReferencedContainer = "container:IOS9ReorderingCollectionViewTutorial.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
<TestableReference
42+
skipped = "NO">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "E25525E11BA961DC00CA18DB"
46+
BuildableName = "IOS9ReorderingCollectionViewTutorialUITests.xctest"
47+
BlueprintName = "IOS9ReorderingCollectionViewTutorialUITests"
48+
ReferencedContainer = "container:IOS9ReorderingCollectionViewTutorial.xcodeproj">
49+
</BuildableReference>
50+
</TestableReference>
51+
</Testables>
52+
<MacroExpansion>
53+
<BuildableReference
54+
BuildableIdentifier = "primary"
55+
BlueprintIdentifier = "E25525C21BA961DC00CA18DB"
56+
BuildableName = "IOS9ReorderingCollectionViewTutorial.app"
57+
BlueprintName = "IOS9ReorderingCollectionViewTutorial"
58+
ReferencedContainer = "container:IOS9ReorderingCollectionViewTutorial.xcodeproj">
59+
</BuildableReference>
60+
</MacroExpansion>
61+
<AdditionalOptions>
62+
</AdditionalOptions>
63+
</TestAction>
64+
<LaunchAction
65+
buildConfiguration = "Debug"
66+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
67+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
68+
launchStyle = "0"
69+
useCustomWorkingDirectory = "NO"
70+
ignoresPersistentStateOnLaunch = "NO"
71+
debugDocumentVersioning = "YES"
72+
debugServiceExtension = "internal"
73+
allowLocationSimulation = "YES">
74+
<BuildableProductRunnable
75+
runnableDebuggingMode = "0">
76+
<BuildableReference
77+
BuildableIdentifier = "primary"
78+
BlueprintIdentifier = "E25525C21BA961DC00CA18DB"
79+
BuildableName = "IOS9ReorderingCollectionViewTutorial.app"
80+
BlueprintName = "IOS9ReorderingCollectionViewTutorial"
81+
ReferencedContainer = "container:IOS9ReorderingCollectionViewTutorial.xcodeproj">
82+
</BuildableReference>
83+
</BuildableProductRunnable>
84+
<AdditionalOptions>
85+
</AdditionalOptions>
86+
</LaunchAction>
87+
<ProfileAction
88+
buildConfiguration = "Release"
89+
shouldUseLaunchSchemeArgsEnv = "YES"
90+
savedToolIdentifier = ""
91+
useCustomWorkingDirectory = "NO"
92+
debugDocumentVersioning = "YES">
93+
<BuildableProductRunnable
94+
runnableDebuggingMode = "0">
95+
<BuildableReference
96+
BuildableIdentifier = "primary"
97+
BlueprintIdentifier = "E25525C21BA961DC00CA18DB"
98+
BuildableName = "IOS9ReorderingCollectionViewTutorial.app"
99+
BlueprintName = "IOS9ReorderingCollectionViewTutorial"
100+
ReferencedContainer = "container:IOS9ReorderingCollectionViewTutorial.xcodeproj">
101+
</BuildableReference>
102+
</BuildableProductRunnable>
103+
</ProfileAction>
104+
<AnalyzeAction
105+
buildConfiguration = "Debug">
106+
</AnalyzeAction>
107+
<ArchiveAction
108+
buildConfiguration = "Release"
109+
revealArchiveInOrganizer = "YES">
110+
</ArchiveAction>
111+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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>IOS9ReorderingCollectionViewTutorial.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>E25525C21BA961DC00CA18DB</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>E25525D61BA961DC00CA18DB</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
<key>E25525E11BA961DC00CA18DB</key>
26+
<dict>
27+
<key>primary</key>
28+
<true/>
29+
</dict>
30+
</dict>
31+
</dict>
32+
</plist>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// AlphabetCell.swift
3+
// IOS9ReorderingCollectionViewTutorial
4+
//
5+
// Created by Arthur Knopper on 16/09/15.
6+
// Copyright © 2015 Arthur Knopper. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class AlphabetCell: UICollectionViewCell {
12+
@IBOutlet var alphabetLabel: UILabel!
13+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// AlphabetViewController.swift
3+
// IOS9ReorderingCollectionViewTutorial
4+
//
5+
// Created by Arthur Knopper on 16/09/15.
6+
// Copyright © 2015 Arthur Knopper. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
private let reuseIdentifier = "Cell"
12+
13+
class AlphabetViewController: UICollectionViewController {
14+
var characterArray = [String]()
15+
16+
override func viewDidLoad() {
17+
super.viewDidLoad()
18+
19+
let str: String = "ABCDEFGHIJKLMNOPQRSTUVWXYX"
20+
21+
for i in str.characters {
22+
characterArray.append(String(i))
23+
}
24+
}
25+
26+
override func didReceiveMemoryWarning() {
27+
super.didReceiveMemoryWarning()
28+
// Dispose of any resources that can be recreated.
29+
}
30+
31+
// MARK: UICollectionViewDataSource
32+
33+
override func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
34+
// 1
35+
// Return the number of sections
36+
return 1
37+
}
38+
39+
40+
override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
41+
// 2 Return the number of items in the section
42+
return characterArray.count
43+
}
44+
45+
override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
46+
// 3
47+
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! AlphabetCell
48+
49+
// Configure the cell
50+
cell.alphabetLabel.text = characterArray[indexPath.row]
51+
52+
return cell
53+
}
54+
55+
override func collectionView(collectionView: UICollectionView, moveItemAtIndexPath sourceIndexPath: NSIndexPath,toIndexPath destinationIndexPath: NSIndexPath) {
56+
// swap values if sorce and destination
57+
let temp = characterArray[sourceIndexPath.row]
58+
characterArray[sourceIndexPath.row] = characterArray[destinationIndexPath.row]
59+
characterArray[destinationIndexPath.row] = temp
60+
}
61+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// AppDelegate.swift
3+
// IOS9ReorderingCollectionViewTutorial
4+
//
5+
// Created by Arthur Knopper on 16/09/15.
6+
// Copyright © 2015 Arthur Knopper. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
16+
17+
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
18+
// Override point for customization after application launch.
19+
return true
20+
}
21+
22+
func applicationWillResignActive(application: UIApplication) {
23+
// 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.
24+
// 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.
25+
}
26+
27+
func applicationDidEnterBackground(application: UIApplication) {
28+
// 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.
29+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30+
}
31+
32+
func applicationWillEnterForeground(application: UIApplication) {
33+
// 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.
34+
}
35+
36+
func applicationDidBecomeActive(application: UIApplication) {
37+
// 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.
38+
}
39+
40+
func applicationWillTerminate(application: UIApplication) {
41+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42+
}
43+
44+
45+
}
46+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "29x29",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "29x29",
11+
"scale" : "3x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "40x40",
16+
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "40x40",
21+
"scale" : "3x"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"size" : "60x60",
26+
"scale" : "2x"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"size" : "60x60",
31+
"scale" : "3x"
32+
}
33+
],
34+
"info" : {
35+
"version" : 1,
36+
"author" : "xcode"
37+
}
38+
}

0 commit comments

Comments
 (0)