I want to import a swift file into another swift file, how to proceed?
Using Xcode 7.0 beta 3 via Swift 2 in an unsuccessful attempt
Unlike Object-C, swift works as if it were 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.
To call a class inside another class we do not use import
. Within the class ViewController
you create a variable and place the value. Example: let meni = Meni()
Use swift import when you want to include packages:
import UIKit
import Foundation
import MeuFramework //Caso tenha criado o seu próprio framework
.swift files already included in your project will be recognized automatically, just call the desired resource without worrying about importing it into another file. But it is essential that he be present in some way in his project.