日記
昨日は調子が良くて結構飲めた.居酒屋行きたいので誰か誘って.
今日書いたコード
print(#line, #file, #fileID, #filePath) // 1 swift-book.playground __lldb_expr_23/swift-book.playground swift-book.playground #sourceLocation(file: "/Users/gurrium/hoge", line: 100) print(#line, #file, #fileID, #filePath) // 100 /Users/gurrium/hoge __lldb_expr_23/hoge /Users/gurrium/hoge #sourceLocation() print(#line, #file, #fileID, #filePath) // 15 /var/folders/ys/d4cmxys124g3r621w72kjrdm0000gn/T/playground23-326d0a..swift __lldb_expr_23/playground23-326d0a..swift /var/folders/ys/d4cmxys124g3r621w72kjrdm0000gn/T/playground23-326d0a..swift
感想
最初と最後の出力が違うのでplaygroundも#sourceLocation(file:,line:)
を使って表示を変えていそう.
The second form of a line control statement, #sourceLocation(), resets the source code location back to the default line numbering and file path.https://docs.swift.org/swift-book/ReferenceManual/Statements.html#ID443