Giter Club home page Giter Club logo

Comments (2)

bvogelzang avatar bvogelzang commented on July 21, 2024

I did not include ViewController.m in the project to be compiled. It's just there to give you an example of how to use SevenSwitch within obj-c code. You'll get the same exact example and result from compiling the project normally with ViewController.swift.

If you want to use a swift source file within obj-c code you simply need to add an import statement like #import "SevenSwitchExample-Swift.h". Where the first part of the import statement is your project/module name (in this case it's SevenSwitchExample). You can see this at the top of ViewController.m. This will take care of providing access to the swift code you would like to use. Xcode will automatically create this file for you so just adding the import statement is all you need to do.

If you want to use an obj-c source file within swift code you need to create what's called a bridging header. More information can be found in the documentation from Apple. I would suggest you read through it to get a good sense of how to mix and match obj-c and swift source files.

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

from sevenswitch.

colasbd avatar colasbd commented on July 21, 2024

Thanks 👍

from sevenswitch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.