This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
func foo() -> String { | |
return "A foo" | |
} | |
} | |
class B: A { | |
override func foo() -> String { | |
return "B foo" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE") | |
buildNumber=$((0x$buildNumber)) | |
buildNumber=$(($buildNumber + 1)) | |
buildNumber=$(printf "%X" $buildNumber) | |
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This gives something resembling an average of the last 1/k values. A k-value of 0.5 will | |
* give the current values equal weight with the previous smooth values, while a k-value of | |
* 0.9 will let the current values only account for 10% of the new smooth value. | |
* | |
* This approach probably consumes a little less memory, and calculates a little faster, | |
* than actually keeping an array of old values. | |
*/ | |
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { | |
CGFloat x = acceleration.x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Core Location example in Beginning iPhone 4 Development shows how to | |
// calculate a distance from a starting point, but it doesn't show how far you've | |
// actually traveled. These changes should let you see an accumulated distance. | |
// Add this to the interface declaration in WhereAmIViewController.h: | |
CLLocationDistance totalDistance; | |
// then replace the last chunk of locationManager:didUpdateToLocation:fromLocation: | |
// with this: |
NewerOlder