This file contains hidden or 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
if let resourcePath = BUNDLE_NAME.resourcePath { | |
let resources = try? FileManager.default.contentsOfDirectory(atPath: resourcePath) | |
print("Resource path: \(resourcePath)") | |
print("Resources in bundle: \(resources ?? [])") | |
} else { | |
print("Bundle.module.resourcePath is nil") | |
} |
This file contains hidden or 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
guard let realityKitFile = BUNDLE_NAME.url(forResource: "FILE_NAME", withExtension: "usdc") else { | |
fatalError("File doesnt exist") | |
} | |
do { | |
let scene = try SCNScene(url: realityKitFile) | |
} catch { | |
// Process Error | |
} |
This file contains hidden or 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
import XCTest | |
func getAppView(identifier: String) -> XCUIElement { | |
return XCUIApplication().descendants(matching: .any).matching(identifier: identifier).element | |
} |
This file contains hidden or 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
import XCTest | |
func openFolderInOpenPanel(folderName: String) { | |
let openPanel = XCUIApplication().dialogs["open-panel"] | |
XCTAssertTrue(openPanel.exists, "Open Panel is visible.") | |
XCTAssertTrue(openPanel.isHittable, "Open Panel is hittable.") | |
let openPanelOpenButton = openPanel.buttons["OKButton"] | |
XCTAssertTrue(openPanelOpenButton.exists, "Open Panel Open Button is visible.") | |
XCTAssertTrue(openPanelOpenButton.isHittable, "Open Panel Open Button is hittable.") |
This file contains hidden or 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
let openPanel = XCUIApplication().dialogs["open-panel"] | |
XCTAssertTrue(openPanel.exists, "Open Panel is visible.") | |
XCTAssertTrue(openPanel.isHittable, "Open Panel is hittable.") | |
let openPanelSearchBox = openPanel.searchFields.firstMatch | |
XCTAssertTrue(openPanelSearchBox.exists, "Open Panel Search Box is visible.") | |
XCTAssertTrue(openPanelSearchBox.isHittable, "Open Panel Search Box hittable.") | |
openPanelSearchBox.tap() | |
openPanelSearchBox.typeText("SEARCH_TEXT") |
This file contains hidden or 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
private func gatherLanguageContent(langugeCode: String) -> UIContent? { | |
debugPrint("\(LanguageCoordinator.identifier) gatherLanguageContent \(DebuggingIdentifiers.actionOrEventInProgress) Generating Content for : \(langugeCode)") | |
let path: String? | |
if isTestEnvironment { | |
path = Bundle(for: type(of: self)).path(forResource: languageCode, ofType: "json") | |
} else { | |
path = Bundle.main.path(forResource: langugeCode, ofType: "json") | |
} |
This file contains hidden or 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
import Foundation | |
func getBookmarkedURL(data: Data) -> URL? { | |
var isStale = false | |
do { | |
let url = try URL(resolvingBookmarkData: data, options: .withSecurityScope, relativeTo: nil, bookmarkDataIsStale: &isStale) | |
debugPrint("\(DebuggingIdentifiers.actionOrEventInProgress) getBookmarkedURL is Stale ? : \(isStale) | url: \(url).") | |
guard !isStale, url.startAccessingSecurityScopedResource() else { | |
debugPrint("\(DebuggingIdentifiers.actionOrEventFailed) getBookmarkedURL - bookmark has expired. Request access again to proceed.") |
This file contains hidden or 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
import Foundation | |
func createSecurityScopedBookmark(for url: URL) -> Data? { | |
do { | |
// Create a bookmark from the selected URL | |
let bookmarkData = try url.bookmarkData(options: .securityScopeAllowOnlyReadAccess, includingResourceValuesForKeys: nil, relativeTo: nil) | |
debugPrint("\(DebuggingIdentifiers.actionOrEventSucceded) createSecurityScopedBookmark - \(bookmarkData)") | |
return bookmarkData | |
} catch { | |
debugPrint("\(DebuggingIdentifiers.actionOrEventFailed) createSecurityScopedBookmark error \(error)") |
This file contains hidden or 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
import Foundation | |
@MainActor | |
private func getFolderURL(title: String, message: String, canChooseFiles: Bool, canChooseDirectories: Bool, allowsMultipleSelection: Bool) async -> URL? { | |
let panel = NSOpenPanel() | |
panel.title = title | |
panel.message = message | |
panel.canChooseFiles = canChooseFiles | |
panel.canChooseDirectories = canChooseDirectories | |
panel.allowsMultipleSelection = allowsMultipleSelection |
This file contains hidden or 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
import Foundation | |
func deleteFileAtLocation(url: URL) { | |
do { | |
try FileManager.default.removeItem(at: url) | |
debugPrint("\(DebuggingIdentifiers.actionOrEventSucceded) deleteFileAtLocation : \(url).") | |
} catch { | |
debugPrint("\(DebuggingIdentifiers.actionOrEventFailed) deleteFileAtLocation : \(error)") | |
} | |
} |
NewerOlder