Skip to content

Commit

Permalink
Add conditional compilation checks for UTI usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tishin committed Sep 25, 2023
1 parent 20d7b55 commit 9939242
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
// Created by Marquis Kurt on 5/29/23.
//

#if canImport(UniformTypeIdentifiers)
import UniformTypeIdentifiers

public protocol Nameable {
var name: String { get }
}

@available(macOS 11.0, *)
extension UTType {
/// The file type that corresponds to a Godot resource file.
Expand All @@ -28,6 +25,11 @@ extension UTType {
/// The file type that corresponds to a Godot tileset resource.
public static var godotTilesetResource = UTType(filenameExtension: "tres")
}
#endif

public protocol Nameable {
var name: String { get }
}

extension ClassInfo {
/// A type alias referencing a class info function that can be registered.
Expand Down Expand Up @@ -148,6 +150,7 @@ extension ClassInfo {
/// - Parameter prefix: The prefix to apply to the property name. Defaults to the class's name if not provided.
/// - Parameter getter: The getter method the editor will call to get the property.
/// - Parameter setter: The setter method the editor will call to set the property.
#if canImport(UniformTypeIdentifiers)
@available(macOS 11.0, *)
public func registerFilePicker(named name: String,
allowedTypes: [UTType],
Expand All @@ -170,6 +173,7 @@ extension ClassInfo {
getter: StringName("\(registeredPrefix)_get_\(name)"),
setter: StringName("\(registeredPrefix)_set_\(name)"))
}
#endif

/// Registers a number field in the number that can be adjusted in a range.
/// - Parameter string: The name of the property that will appear in the editor.
Expand Down

0 comments on commit 9939242

Please sign in to comment.