Skip to content

Commit

Permalink
Get rid of some @objc tags
Browse files Browse the repository at this point in the history
  • Loading branch information
cochrane committed May 2, 2024
1 parent 5df4711 commit 6b7af1d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 20 deletions.
8 changes: 2 additions & 6 deletions GLLara/GLLModel.swift
Expand Up @@ -80,12 +80,8 @@ enum GLLModelLoadingErrorCode: Int {
@objc var baseURL: URL! = nil
@objc var parameters: GLLModelParams! = nil

@objc var hasBones: Bool {
return bones.count > 0
}

@objc var rootBones: [GLLModelBone] {
return bones.filter({ bone in bone.parent == nil } as (GLLModelBone)->Bool)
var hasBones: Bool {
return bones.count > 1
}

@objc var cameraTargetNames: [GLLCameraTargetDescription] {
Expand Down
4 changes: 2 additions & 2 deletions GLLara/GLLModelBone.swift
Expand Up @@ -62,7 +62,7 @@ import Foundation
}

// Export
@objc func writeASCII() -> String {
func writeASCII() -> String {
var result = ""

result.append("\(name)\n")
Expand All @@ -72,7 +72,7 @@ import Foundation
return result
}

@objc func writeBinary() -> Data {
func writeBinary() -> Data {
let stream = TROutDataStream()

stream.appendPascalString(name)
Expand Down
4 changes: 2 additions & 2 deletions GLLara/GLLModelGltf.swift
Expand Up @@ -510,7 +510,7 @@ extension Data {

class GLLModelGltf: GLLModel {

@objc convenience init(url: URL, isBinary: Bool = false) throws {
convenience init(url: URL, isBinary: Bool = false) throws {
let data = try Data(contentsOf: url, options: .mappedIfSafe)

if (isBinary) {
Expand Down Expand Up @@ -795,7 +795,7 @@ class GLLModelGltf: GLLModel {
self.meshes.append(modelMesh)
}

@objc init(jsonData: Data, baseUrl: URL, binaryData: Data? = nil) throws {
init(jsonData: Data, baseUrl: URL, binaryData: Data? = nil) throws {
let decoder = JSONDecoder()
let document = try decoder.decode(GltfDocument.self, from: jsonData)

Expand Down
2 changes: 1 addition & 1 deletion GLLara/GLLModelMesh.swift
Expand Up @@ -15,7 +15,7 @@ import simd
*/
@objc class GLLModelMesh: NSObject {
// For subclasses
@objc init(asPartOfModel model: GLLModel) {
init(asPartOfModel model: GLLModel) {
super.init()
self.model = model
}
Expand Down
4 changes: 2 additions & 2 deletions GLLara/GLLModelMeshObj.swift
Expand Up @@ -8,8 +8,8 @@

import Foundation

@objc class GLLModelMeshObj: GLLModelMesh {
@objc init(asPartOfModel model: GLLModel, fileVertexAccessors: GLLVertexAttribAccessorSet, countOfVertices: Int, elementData: Data, textures: [String: GLLTextureAssignment], renderParameterValues: [String: AnyObject]) throws {
class GLLModelMeshObj: GLLModelMesh {
init(asPartOfModel model: GLLModel, fileVertexAccessors: GLLVertexAttribAccessorSet, countOfVertices: Int, elementData: Data, textures: [String: GLLTextureAssignment], renderParameterValues: [String: AnyObject]) throws {
super.init(asPartOfModel: model)
countOfUVLayers = 1

Expand Down
4 changes: 2 additions & 2 deletions GLLara/GLLModelObj.swift
Expand Up @@ -15,8 +15,8 @@ import Metal
* every material used. XNALara-specific extensions and simplifications are
* supported, too.
*/
@objc class GLLModelObj: GLLModel {
@objc init(contentsOf url: URL) throws {
class GLLModelObj: GLLModel {
init(contentsOf url: URL) throws {

file = try ObjFile(from: url)
materialFiles = try file.materialLibraries.map { try MtlFile(from: $0) }
Expand Down
10 changes: 5 additions & 5 deletions GLLara/GLLModelXNALara.swift
Expand Up @@ -8,13 +8,13 @@

import Foundation

@objc class GLLModelXNALara: GLLModel {
@objc convenience init(binaryFromFile file: URL!, parent: GLLModel!) throws {
class GLLModelXNALara: GLLModel {
convenience init(binaryFromFile file: URL!, parent: GLLModel!) throws {
let data = try Data(contentsOf: file, options: .mappedIfSafe)
try self.init(binaryFrom: data, baseURL: file, parent: parent)
}

@objc init(binaryFrom data: Data!, baseURL: URL!, parent: GLLModel?) throws {
init(binaryFrom data: Data!, baseURL: URL!, parent: GLLModel?) throws {
super.init()

guard data.count >= 2 else {
Expand Down Expand Up @@ -136,13 +136,13 @@ import Foundation
// Ignore the trailing data. XNALara writes some metadata there that varies depending on the version, but doesn't seem to be actually necessary for anything (famous last words…?)
}

@objc convenience init(ASCIIFromFile file: URL!, parent: GLLModel?) throws {
convenience init(ASCIIFromFile file: URL!, parent: GLLModel?) throws {
var encoding: String.Encoding = .utf8
let source = try String(contentsOf: file, usedEncoding: &encoding)
try self.init(asciiFrom: source, baseURL: file, parent: parent)
}

@objc init(asciiFrom string: String, baseURL: URL, parent: GLLModel?) throws {
init(asciiFrom string: String, baseURL: URL, parent: GLLModel?) throws {
super.init()

self.baseURL = baseURL
Expand Down

0 comments on commit 6b7af1d

Please sign in to comment.