Skip to content

Instantly share code, notes, and snippets.

@1024jp
Last active October 10, 2019 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1024jp/8e69760462c0d8d6b67d76726f3018ad to your computer and use it in GitHub Desktop.
Save 1024jp/8e69760462c0d8d6b67d76726f3018ad to your computer and use it in GitHub Desktop.
//
// 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