ios - How to import framework in swift? -



ios - How to import framework in swift? -

what proper way of importing scheme framework in swift?

there 2 ways know of, think.

1) target->build phases->link binary libraries -> + button -> add together framework. adds framework , shows graphically in navigator.

2) import framework in bridging-header.h

in case of storekit framework example, method 1) add together through xcode ui. in method 2) type in import <storekit/storekit.h> in bridging-header.h

which 1 of these right in swift?

if correctly don't have separate build target framework (you built xcode 5) , included framework project's build target.

the part of documentation you're referring frameworks within different targets. since framework in project's target part of documentation doesn't apply here.

in case can't import of framework in swift file. that's why error message "no such module myframework". myframework no module -- part of project's module (which default determined product name). such classes in framework should accessible.

however framework written in objective-c. have import swift facing classes in bridging-header described here.

please note has nil swift import of module. import directive in bridging-header file notifies compiler 'translate' objective-c header files swift syntax , makes public header visible swift.

so should now?

first import header files you're interested in in bridging-header. need import headers interact in swift. try compile project in stage. if xcode can't find header files of framework problem not related swift or xcode 6 problem including frameworks in general. after seek instantiate class imported in bridging-header, maybe in appdelegate.swift. xcode auto-completion should offer type names.

hope helps.

import uikit import myframework

ios xcode swift

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -