Git Product home page Git Product logo

Comments (8)

pNre avatar pNre commented on September 26, 2024

Yes, it's Xcode:
Xcode does not support building static libraries that include Swift code. (17181019)

from exswift.

rizal72 avatar rizal72 commented on September 26, 2024

But I've succeded in building a custom library and then exported it as a .framework bundle.
Than I've included it in my project and it compiles correctly... using XCode_6 beta 4.
The issue happens only with your sources: if I include them in my custom library it stops compiling. If I delete them it starts compiling again. (?!)

from exswift.

pNre avatar pNre commented on September 26, 2024

A Swift library?

from exswift.

rizal72 avatar rizal72 commented on September 26, 2024

Yes. It's a kind of test library containing only a few classes, with some public class methods. And It works...
Create a new project then, under "iOS/Frameworks & Library", chose "Cocoa Touch Framework" as a template. Then add a Swift Class with a public class method and compile the library.
Import this library in another project, under "Embedded Binaries", and it works as charme. Just be careful to copy the correct version of the library (Simulator, iOS, etc..) according to the kind of compilation you need.

from exswift.

pNre avatar pNre commented on September 26, 2024

I followed your instructions and created a test framework, with a simple extension, just like this:

public extension Array {
    public func test () -> Element? {
        return nil
    }
}

this way the linker outputs symbol(s) not found.

Changing the function's return type:

public extension Array {
    public func test () -> Int? {
        return nil
    }
}

compiles fine.

Looks like a bug in the compiler when using the generic type Element or T defined in Array.

I know it's ugly but if you need to use ExSwift in your project compile the sources with the rest of the project.

from exswift.

rizal72 avatar rizal72 commented on September 26, 2024

Yes! You found it! Probably the compiler does not include all the Types still.
Thanks

from exswift.

kostiakoval avatar kostiakoval commented on September 26, 2024

This is Xcode bug. It's not possible to make Frameworks with extension to generic classes
https://devforums.apple.com/message/983747#983747

And it doesn't work to install this project with cocoa pods as well (because of linking error).
Probably the best solution would be use submodules and copy all source files to your target

from exswift.

kostiakoval avatar kostiakoval commented on September 26, 2024

1.Add ExSwift as a submodule
2.Open the ExSwift project folder, and drag ExSwift sub folder with source code into the file navigator of your Xcode project. Make sure you select add to target
3.Use it

from exswift.

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.