Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
continue to anticipate Swift 2.2 / 3 (mostly increment operator), plu…
…s fix a few other minor bugs
  • Loading branch information
mattneub committed Feb 11, 2016
1 parent 5616a88 commit 7ad1ce3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 24 deletions.
Expand Up @@ -110,10 +110,9 @@ class ViewController : UIViewController {

case 9:
var values = [0.0]
// comma is legal in the for block!
//WARNING this will have to be replaced; I already have a replacement ready
for (var i = 20, direction = 1.0; i < 60; i += 5, direction *= -1) { // alternate directions
values.append( direction * M_PI / Double(i) )
// work around loss of C for loop, but sorry to see it go
for (ix,i) in 20.stride(to: 60, by: 5).enumerate() {
values.append( (ix % 2 == 1 ? -1.0 : 1.0) * M_PI / Double(i) )
}
values.append(0.0)
print(values)
Expand Down Expand Up @@ -143,9 +142,9 @@ class ViewController : UIViewController {

// second animation (waggle)
var values = [0.0]
//WARNING this will have to be replaced; I already have a replacement ready
for (var i = 20, direction = 1.0; i < 60; i += 5, direction *= -1) { // alternate directions
values.append( direction * M_PI / Double(i) )
// work around loss of C for loop, but sorry to see it go
for (ix,i) in 20.stride(to: 60, by: 5).enumerate() {
values.append( (ix % 2 == 1 ? -1.0 : 1.0) * M_PI / Double(i) )
}
values.append(0.0)
let anim2 = CAKeyframeAnimation(keyPath:"transform")
Expand Down
Expand Up @@ -30,7 +30,7 @@ class ViewController : UIViewController, SecondViewControllerDelegate {
let pair = self.pairs[self.ix]
self.original = UIModalPresentationStyle(rawValue:pair.0)!
self.adaptive = UIModalPresentationStyle(rawValue:pair.1)!
self.ix++
self.ix += 1
}

@IBAction func doPresent(sender:AnyObject?) {
Expand Down
Expand Up @@ -27,7 +27,7 @@ class RootViewController : UITableViewController {
lab.text = "Row \(indexPath.row) of section \(indexPath.section)"
if lab.tag != 999 {
lab.tag = 999
print("New cell \(++self.cells)")
self.cells += 1; print("New cell \(self.cells)")
}


Expand Down
Expand Up @@ -115,7 +115,7 @@ class RootViewController : UITableViewController {

/*
override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
println(view) // prove we are reusing header views
print(view) // prove we are reusing header views
}
*/

Expand Down
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6205" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10109" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6198"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10083"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RootViewController" customModule="ch21p745dynamicTableContent" customModuleProvider="target">
Expand All @@ -20,12 +20,4 @@
</connections>
</tableView>
</objects>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4">
<size key="portraitSize" width="320" height="568"/>
<size key="landscapeSize" width="568" height="320"/>
</simulatedScreenMetrics>
</simulatedMetricsContainer>
</document>
Expand Up @@ -112,7 +112,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell

// checkmark in top left corner when selected
UIGraphicsBeginImageContextWithOptions(CGSizeMake(cell.bounds.size.width, cell.bounds.size.height), NO, 0);
CGContextRef con = UIGraphicsGetCurrentContext()!;
CGContextRef con = UIGraphicsGetCurrentContext();
NSShadow* shadow = [NSShadow new];
shadow.shadowColor = [UIColor darkGrayColor];
shadow.shadowOffset = CGSizeMake(2,2);
Expand Down
Expand Up @@ -37,10 +37,10 @@ class MyLayout : UICollectionViewLayout {
NSIndexPath(forItem:j, inSection:i))
att.frame = CGRectMake(CGFloat(x)*cellside,CGFloat(y)*cellside,cellside,cellside)
atts += [att]
x++
x += 1
if CGFloat(x) >= shortside {
x = 0
y++
y += 1
}
}
}
Expand Down
Expand Up @@ -35,7 +35,7 @@ class ViewController: UIViewController {

func doNextButton(sender:AnyObject) {
var ix = self.textFields.indexOf(self.fr as! UITextField)!
ix = ++ix % self.textFields.count
ix = (ix + 1) % self.textFields.count
let v = self.textFields[ix]
v.becomeFirstResponder()
}
Expand Down

0 comments on commit 7ad1ce3

Please sign in to comment.