I have written about printing out the document directory in #172, but here's a obvious tweak on hindsight, along with updates for current Swift language changes:
#if DEBUG
let docPath = FileManager.default.urls(for: FileManager.SearchPathDirectory.documentDirectory, in: FileManager.SearchPathDomainMask.userDomainMask).last?.path
print("docPath: \(docPath)")
#endif
Your feedback is valuable: Do you want more nuggets like this? Yes or No
.
Here's a few related nuggets:
- iOS Dev Nugget 314 Checked Array Subscripting
- iOS Dev Nugget 310 Weak Reference Wrapper Class
- iOS Dev Nugget 308 Careful with early return statements in functions that return void
- iOS Dev Nugget 307 Array Out of Bounds
- iOS Dev Nugget 306 Underscores in Numeric Literals
- iOS Dev Nugget 303 Use Enums for States
- iOS Dev Nugget 300 Pipe Operator
- iOS Dev Nugget 292 for-where
- iOS Dev Nugget 291 Implicit Member Expressions
- iOS Dev Nugget 287 Modifying a Property Which is a Struct Triggers didSet
- iOS Dev Nugget 265 value type cannot have a stored property that recursively contains it
- iOS Dev Nugget 257 Asserts
- iOS Dev Nugget 251 Retrieving the Current View Controller
- iOS Dev Nugget 246 Mapping Swift and Obj-C Method Names
- iOS Dev Nugget 244 IteratorProtocol
- iOS Dev Nugget 241 Swift Enums with Labels
- iOS Dev Nugget 240 Print an Object's Unique Identifier
- iOS Dev Nugget 238 Keep Code in Method at the Same Level of Abstraction
- iOS Dev Nugget 234 #available and @available
- iOS Dev Nugget 229 Promises
- iOS Dev Nugget 224 Lazy Collections
- iOS Dev Nugget 215 dump Instead of print for Swift Structs
- iOS Dev Nugget 211 Higher Order Functions: map, filter, reduce
- iOS Dev Nugget 209 Swift Defer
- iOS Dev Nugget 207 Swift Nil-Coalescing Operator
- iOS Dev Nugget 206 Date doesRelativeDateFormatting
- iOS Dev Nugget 205 The Never Return Type in Swift
- iOS Dev Nugget 204 Swift @autoclosure
- iOS Dev Nugget 203 Swift Measurement
- iOS Dev Nugget 202 Swift Enumerations to Encode States
- iOS Dev Nugget 201 Swift Pattern Matching
- iOS Dev Nugget 200 Swift flatMap
- iOS Dev Nugget 199 Swift Talk Video Series
- iOS Dev Nugget 198 KZPlayground
- iOS Dev Nugget 197 App Initialization Code
- iOS Dev Nugget 196 Rename Refactoring for Swift Code
- iOS Dev Nugget 193 Result Enumeration
- iOS Dev Nugget 189 Xcode's Fix All in Scope
- iOS Dev Nugget 188 SwiftLint
- iOS Dev Nugget 187 Creating a Singleton Class in Swift
- iOS Dev Nugget 186 Injection for Xcode
- iOS Dev Nugget 185 Disabling Content Change Animation in CATextLayer
- iOS Dev Nugget 184 Async Library
- iOS Dev Nugget 183 Quality of Service Classes
- iOS Dev Nugget 182 Tracking the swift-evolution Git Repository
- iOS Dev Nugget 181 Swift Selectors
- iOS Dev Nugget 180 Low Power Mode
- iOS Dev Nugget 177 Push Notifications Testing During Development
- iOS Dev Nugget 176 Git no-commit Pre-commit Hook
- iOS Dev Nugget 175 Displaying a Popover in iPhone App
- iOS Dev Nugget 174 View Controller Containment to Avoid Growing a Fat View Controller Base Class
- iOS Dev Nugget 172 Print App Document Path
- iOS Dev Nugget 168 Using Blocks to Manage Contexts
- iOS Dev Nugget 161 Read Smalltalk Best Practice Patterns
- iOS Dev Nugget 158 Checking if Newer APIs Are Available In Older iOS Versions (II)
- iOS Dev Nugget 149 Timepiece, a Swift Library for Handling Dates
- iOS Dev Nugget 143 Don't Forget SQLite
- iOS Dev Nugget 142 Grand Central Dispatch
- iOS Dev Nugget 141 Great Swift Standard Library Examples Covered in Playground (Swift 2.0)
- iOS Dev Nugget 138 Interoperability: Using Enumerations Defined In Objective-C from Swift
- iOS Dev Nugget 137 Named Tuple Elements
- iOS Dev Nugget 136 Auto Layout with Cartography
- iOS Dev Nugget 135 CAShapeLayer, Animated Views and XCPShowView()
- iOS Dev Nugget 133 Dollar.swift
- iOS Dev Nugget 132 XCPCaptureValue in Swift Playgrounds
- iOS Dev Nugget 131 Running Asynchronous Code in Swift Playgrounds
- iOS Dev Nugget 129 Browsing the Swift Standard Library
- iOS Dev Nugget 124 performSelector:withObject:afterDelay: in Swift
- iOS Dev Nugget 123 Using dynamicType in Swift
- iOS Dev Nugget 116 method() is unavailable: use object construction Class()
.