How to import Swift code to Objective-C -
i have written library on swift sclalertview-swift , wasn't able import current project on (objective-c)
is there ways import it?
#import "sclalertview.swift" - 'sclalertview.swift' file not found
you need import targetname-swift.h
. note it's target name - other answers make mistake of using class name.
this single file autogenerated header defines objective-c interfaces swift classes in project either annotated @objc
or inherit nsobject
.
if target name contain spaces, replace them underscores (e.g. "my project" becomes "my_project-swift.h")
Comments
Post a Comment