How to use struct in custom framework in ios/swift?

1.1k views Asked by At

I need to use struct in my custom framework, how can the following be done?

Here my framework:

MyFramework.framework

public class SomeClass : NSObject {

    public struct myDetails {

        public var firstName: String?
        public var lastName: String?

        public init(fName: String? LastName lName: String?) {
            self.firstName = fName
            self.lastName = lName
        }//init end

    }// struct end

    public func fillStruct(inout myStruct: myDetails) {

        myStruct.firstName = "John"
        myStruct.lastName = "Devid"
    }


}// class end

Here's my Application:

// ViewController.swift

import MyFramework

var refObj: SomeClass?

override func ViewDidLoad() {
    refObj = SomeClass()

    let tempStruct = refObj.myDetails(fName: nil LastName lName: nil) // I CANT ABLE ACCESS LIKE THIS.

    refObj.fillStruct(&tempStruct)
}

What I want, is my application to send the data to the struct and my framework to fill the struct and finish the function.

How can this be achieved?

0

There are 0 answers