To display the current version of an iOS app in the settings
- Add an entry like this in
Settings.bundle/Root.plist
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
PSTitleValueSpecifier
/// Provides convenience accesors to some info dictionary keys | |
extension Bundle { | |
var identifier: String? { | |
return string(forInfoDictionaryKey: "CFBundleIdentifier") | |
} | |
var displayName: String? { | |
return string(forInfoDictionaryKey: "CFBundleDisplayName") | |
} | |
extension CLLocation: Encodable { | |
public enum CodingKeys: String, CodingKey { | |
case latitude | |
case longitude | |
case altitude | |
case horizontalAccuracy | |
case verticalAccuracy | |
case speed | |
case course | |
case timestamp |
extension CLLocation { | |
/// Compass bearing from a known location | |
/// | |
/// Shamelessly stolenfrom // https://stackoverflow.com/questions/26998029/calculating-bearing-between-two-cllocation-points-in-swift | |
/// | |
/// - Parameter location: The `CLocation` to calculate the bearing from. | |
/// - Returns: The `CLLocationDirection` representing the compass bearing. | |
func bearing(from location: CLLocation) -> CLLocationDirection { | |
func degreesToRadians(degrees: CLLocationDirection) -> CLLocationDirection { return degrees * .pi / 180.0 } |
extension String { | |
/// Replace all instances of characters in a character set. | |
/// | |
/// - Parameters: | |
/// - characterSet: The `CharacterSet` containing the characters to replace in the string. | |
/// - replacementString: The `String` to replace the matched characters with. | |
/// - Returns: A new `String` with all characters in the character set replaced by the replacement string. | |
func replacingCharacters(in characterSet: CharacterSet, with replacementString: String = "") -> String { | |
return self.components(separatedBy: characterSet).joined(separator: replacementString) | |
} |
// | |
// NSPersonNameComponents.swift | |
// | |
import Foundation | |
extension NSPersonNameComponents { | |
// Because the web is generally xenophobic… | |
var xenophobicName: (firstName: String, lastName: String)? { | |
func logPretty(message: String? = nil, file: String = __FILE__, line: UInt = __LINE__, function: StaticString = __FUNCTION__) { | |
var pretty = "\((file as NSString).lastPathComponent)(\(line)) : \(function)" | |
if let message = message where !message.isEmpty { | |
pretty += " ☞ \(message)" | |
} | |
print(pretty) | |
} |
To display the current version of an iOS app in the settings
Settings.bundle/Root.plist
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
PSTitleValueSpecifier
Fix for missing documentation indexes and other anomolies in the Xcode documentation viewer. Mine seemed to get all borked up with some beta relaeases. Shamelessly ripped off from this thread.
~/Library/Caches/com.apple.dt.Xcode
.~/Library/Developer/Shared/Documentation/DocSets/
./Applications/Xcode.app/Contents/Developer/Documentation/DocSets/
.THIS STRING IS 256 CHARACTERS xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |