Skip to content

Commit e7f64ec

Browse files
committed
updated for Swift 1.2
1 parent ee05332 commit e7f64ec

File tree

9 files changed

+108
-19
lines changed

9 files changed

+108
-19
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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>IDESourceControlProjectFavoriteDictionaryKey</key>
6+
<false/>
7+
<key>IDESourceControlProjectIdentifier</key>
8+
<string>B844A41F-CFA2-4B71-9298-122752AA808A</string>
9+
<key>IDESourceControlProjectName</key>
10+
<string>IOS8SwiftCustomizeTableViewTutorial</string>
11+
<key>IDESourceControlProjectOriginsDictionary</key>
12+
<dict>
13+
<key>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</key>
14+
<string>https://github.com/ioscreator/ioscreator.git</string>
15+
</dict>
16+
<key>IDESourceControlProjectPath</key>
17+
<string>IOS8SwiftCustomizeTableViewTutorial/IOS8SwiftCustomizeTableViewTutorial.xcodeproj</string>
18+
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
19+
<dict>
20+
<key>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</key>
21+
<string>../../..</string>
22+
</dict>
23+
<key>IDESourceControlProjectURL</key>
24+
<string>https://github.com/ioscreator/ioscreator.git</string>
25+
<key>IDESourceControlProjectVersion</key>
26+
<integer>111</integer>
27+
<key>IDESourceControlProjectWCCIdentifier</key>
28+
<string>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</string>
29+
<key>IDESourceControlProjectWCConfigurations</key>
30+
<array>
31+
<dict>
32+
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
33+
<string>public.vcs.git</string>
34+
<key>IDESourceControlWCCIdentifierKey</key>
35+
<string>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</string>
36+
<key>IDESourceControlWCCName</key>
37+
<string>ioscreator</string>
38+
</dict>
39+
</array>
40+
</dict>
41+
</plist>

IOS8SwiftCustomizeTableViewTutorial/IOS8SwiftCustomizeTableViewTutorial/NumbersViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ class NumbersViewController: UITableViewController {
4040

4141

4242
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
43-
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell
43+
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell
4444

4545
// Configure the cell...
46-
cell.textLabel.text = numbers[indexPath.row]
46+
cell.textLabel?.text = numbers[indexPath.row]
4747
cell.backgroundColor = UIColor.clearColor()
4848

4949
return cell
0 Bytes
Binary file not shown.

IOS8SwiftDraggingViewsTutorial/IOS8SwiftDraggingViewsTutorial/MyView.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ class MyView: UIView {
3434
self.center = CGPointMake(lastLocation.x + translation.x, lastLocation.y + translation.y)
3535
}
3636

37-
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
37+
/*override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
38+
// Promote the touched view
39+
self.superview?.bringSubviewToFront(self)
40+
41+
// Remember original location
42+
lastLocation = self.center
43+
}*/
44+
45+
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
3846
// Promote the touched view
3947
self.superview?.bringSubviewToFront(self)
4048

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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>IDESourceControlProjectFavoriteDictionaryKey</key>
6+
<false/>
7+
<key>IDESourceControlProjectIdentifier</key>
8+
<string>9E79244F-A48A-4221-B9E0-34DC8F4A4D6C</string>
9+
<key>IDESourceControlProjectName</key>
10+
<string>IOS8SwiftDrawingCirclesTutorial</string>
11+
<key>IDESourceControlProjectOriginsDictionary</key>
12+
<dict>
13+
<key>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</key>
14+
<string>https://github.com/ioscreator/ioscreator.git</string>
15+
</dict>
16+
<key>IDESourceControlProjectPath</key>
17+
<string>IOS8SwiftDrawingCirclesTutorial/IOS8SwiftDrawingCirclesTutorial.xcodeproj</string>
18+
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
19+
<dict>
20+
<key>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</key>
21+
<string>../../..</string>
22+
</dict>
23+
<key>IDESourceControlProjectURL</key>
24+
<string>https://github.com/ioscreator/ioscreator.git</string>
25+
<key>IDESourceControlProjectVersion</key>
26+
<integer>111</integer>
27+
<key>IDESourceControlProjectWCCIdentifier</key>
28+
<string>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</string>
29+
<key>IDESourceControlProjectWCConfigurations</key>
30+
<array>
31+
<dict>
32+
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
33+
<string>public.vcs.git</string>
34+
<key>IDESourceControlWCCIdentifierKey</key>
35+
<string>0B5DE09DB2E2FB7363ABEFE25201CBF9E247BD54</string>
36+
<key>IDESourceControlWCCName</key>
37+
<string>ioscreator</string>
38+
</dict>
39+
</array>
40+
</dict>
41+
</plist>

IOS8SwiftDrawingCirclesTutorial/IOS8SwiftDrawingCirclesTutorial/ViewController.swift

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@ class ViewController: UIViewController {
1515
self.view.backgroundColor = UIColor.lightGrayColor()
1616
}
1717

18-
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
19-
20-
// loop through the touches
21-
for touch in touches {
22-
23-
// Set the Center of the Circle
24-
var circleCenter = touch.locationInView(view)
25-
26-
// Set a random Circle Radius
27-
var circleWidth = CGFloat(25 + (arc4random() % 50))
28-
var circleHeight = circleWidth
29-
30-
31-
// Create a new CircleView
32-
var circleView = CircleView(frame: CGRectMake(circleCenter.x, circleCenter.y, circleWidth, circleHeight))
33-
view.addSubview(circleView)
18+
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
19+
if let touch = touches as? Set<UITouch> {
20+
// Set the Center of the Circle
21+
var circleCenter = touch.first!.locationInView(view)
22+
23+
// Set a random Circle Radius
24+
var circleWidth = CGFloat(25 + (arc4random() % 50))
25+
var circleHeight = circleWidth
26+
27+
28+
// Create a new CircleView
29+
var circleView = CircleView(frame: CGRectMake(circleCenter.x, circleCenter.y, circleWidth, circleHeight))
30+
view.addSubview(circleView)
3431
}
32+
33+
3534
}
3635

3736
override func didReceiveMemoryWarning() {

0 commit comments

Comments
 (0)