Last active
October 10, 2019 06:05
-
-
Save 1024jp/8e69760462c0d8d6b67d76726f3018ad to your computer and use it in GitHub Desktop.
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
// | |
// AppDelegate.swift | |
// Moof | |
// | |
// Created by 1024jp on 2019-10-10. | |
// © 1024jp | |
// | |
import Cocoa | |
@NSApplicationMain | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
func applicationDidFinishLaunching(_ aNotification: Notification) { | |
let path = NSString(string: "foo").appendingPathComponent("bar") | |
print((path as NSString).className) // -> NSPathStore2 | |
let range = path.range(of: "foo/bar")! | |
let substring = path[range] // -[NSPathStore2 characterAtIndex:]: index (7) beyond bounds (7) | |
print(substring) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment