Import a Swift into another Swift

Asked

Viewed 392 times

0

I want to import a Swift file into another Swift file, how to proceed ?

Tentativa de implementar a importação

Using Xcode 7.0 beta 3 via Swift 2 in an unsuccessful attempt

3 answers

1


Unlike Object-C Swift works like Java, it automatically checks the classes you have in the project, interpreting them as an object.

So you can Declare an object:

let meni = Meni()

From the instantiated class you can pick up your methods.

0

To call a class within another class we do not use the import. Within the class ViewController you create a variable and set the value. Example: let meni = Meni()

0

Use Swift import when you want to include packages:

import UIKit 
import Foundation
import MeuFramework        //Caso tenha criado o seu próprio framework

Archives. Swift already included in your project, will be recognized automatically, just call the desired feature without worrying about importing it into another file. But it is essential that he be present in some way in your project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.