home Forums # Technical Support Integrating Fuzzylite with Swift Framework

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2128
    Unknown
    Member

    Hi Juan,

    Thank you for creating this library again – it is really awesome! I am currently trying to do the following:
    – Create a Swift framework – includes fuzzylite library
    – Use the above Swift framework with my iOS app

    I had earlier created a repository on github that I had informed you of (https://github.com/senabhishek/fuzzyliteAndSwift) where I had integrated fuzzylite and Swift. However, in that case, I had was developing an iOS app and I directly integrated the fuzzylite library into the Swift project by creating a bridging header in my Swift project.

    I am at a point where I want to decouple things in my iOS app and want to include the fuzzylite library into a Swift framework instead of directly including it into a Swift app project. I am having a lot of difficulty in doing this. After a lot of looking on Google, I understand that in order to include fuzzylite as a library into a Swift framework, I need to create a module map that includes the fuzzylite headers as a dependency – sort of like https://spin.atomicobject.com/2015/02/23/c-libraries-swift/.

    Can you please offer some suggestions?

    Cheers,
    Abhishek.

    #2132

    Hi Abhishek,

    thank you for your post.

    I have looked around for a bit, but cannot find anything promising. The best options I see would be:

    (1) Write fuzzylite in swift. The library is well structured, which means that it would not be too hard to rewrite it in Swift. I could help you out by explaining whatever you have trouble with, and guiding you where to start and what to work on. Perhaps you could check the source code of fuzzylite or jfuzzylite and decide for yourself. If you were to start, the most reasonable way would be in the following order: Norms (T-Norms and S-Norms), Hedges, Terms, Variables, Rules, Engine. As for Importers and Exporters, I would only include FllImporters and FllExporters.

    (2) Use fuzzylite binary. In fuzzylite (C++) and jfuzzylite (java), there is a console application that allows you to load an engine from FLL code, pass input values, and automatically obtain output values. You would need to execute the binary from your code. Check the binary.

    juan@macbook:~/Development/fl/fuzzylite/fuzzylite/bin$ ./fuzzylite
    
    usage: fuzzylite inputfile outputfile
       or: fuzzylite [-i inputfile] [-if format] [-o outputfile] [-of format] [-example letter] [-decimals number] [-d datafile] [-dmaximum number] [-dheader boolean] [-dinputs boolean] 
    
    where:
    -i          inputfile    file to import your engine from
    -if         format       format of the file to import (fll | fis | fcl)
    -o          outputfile   file to export your engine to
    -of         format       format of the file to export (fll | fld | cpp | java | fis | fcl)
    -example    letter       if not inputfile, built-in example to use as engine: (m)amdani or (t)akagi-sugeno
    -decimals   number       number of decimals to write floating-poing values
    -d          datafile     if exporting to fld, file of input values to evaluate your engine on
    -dmaximum   number       if exporting to fld without datafile, maximum number of results to export
    -dheader    boolean      if true and exporting to fld, include headers
    -dinputs    boolean      if true and exporting to fld, include input values
    
    Visit http://fuzzylite.com/ for more information.
    
    Copyright (C) 2010-2015 by FuzzyLite Limited.
    All rights reserved.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.