Details

    • Type: Epic
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 7.1.0
    • Fix Version/s: Release 8.0.0
    • Component/s: iOS
    • Labels:
    • Epic Name:
      iOS: Add Swift modules support
    • Story Points:
      63
    • Sprint:
      2017 Sprint 02 SDK, 2018 Sprint 07 SDK, 2018 Sprint 08 SDK, 2018 Sprint 09 SDK, 2018 Sprint 10 SDK, 2018 Sprint 11 SDK, 2018 Sprint 12 SDK, 2018 Sprint 13 SDK, 2018 Sprint 14 SDK, 2018 Sprint 15 SDK, 2018 Sprint 16 SDK, 2016 Sprint 17 SDK, 2018 Sprint 18 SDK, 2018 Sprint 19 SDK, 2018 Sprint 20 SDK, 2018 Sprint 21, 2018 Sprint 22, 2018 Sprint 23, 2018 Sprint 24, 2018 Sprint 25

      Description

      It is not currently possible to add Swift code to a Titanium module.

      Steps to reproduce:

      1. ti create -n ti.test -p ios --id ti.test -t module -url "http://test.com" -d .
      2. Open up the project in Xocde. Confirm it builds.
      3. Add a Swift file and accept the addition of a “bridging header".
      4. Attempt to build. It then prompts to update the minimum target version from 4.0 to 7.0
      5. Build and get the following error:

       Libtool build/ti.test.build/Release-iphoneos/ti.test.build/Objects-normal/arm64/libTiTest.a normal arm64
          cd /Users/ingo/Documents/ti.test/iphone
          export IPHONEOS_DEPLOYMENT_TARGET=7.0
          export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/ingo/Documents/adt-bundle-mac-x86/sdk/platform-tools:/Users/ingo/Documents/adt-bundle-mac-x86/sdk/tools:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
          /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/Users/ingo/Documents/ti.test/iphone/build/Release-iphoneos -filelist /Users/ingo/Documents/ti.test/iphone/build/ti.test.build/Release-iphoneos/ti.test.build/Objects-normal/arm64/TiTest.LinkFileList -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -force_load -Xlinker /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphoneos.a -Xlinker -add_ast_path -Xlinker /Users/ingo/Documents/ti.test/iphone/build/ti.test.build/Release-iphoneos/ti.test.build/Objects-normal/arm64/TiTest.swiftmodule -framework Foundation -o /Users/ingo/Documents/ti.test/iphone/build/ti.test.build/Release-iphoneos/ti.test.build/Objects-normal/arm64/libTiTest.a
      error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
      Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
      Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
      

      This is the error reported here: http://stackoverflow.com/questions/24020986/error-when-compiling-a-static-library-using-swift-unknown-option-character-x

      And this is because you can't built a static library using Swift:

      http://openradar.appspot.com/radar?id=5536341827780608

      It may be possible to get around this:

      http://andelf.github.io/blog/2014/06/25/write-swift-module-with-swift-cont/

      Generate .swiftmodule .swiftdoc

      xcrun swift -sdk $ (xcrun --show-sdk-path --sdk macosx) SwiftyJSON.swift -emit-library -emit-module -module-name SwiftyJSON -v -o libswiftSwiftyJSON.dylib -module-link-name swiftSwiftyJSON
      

      Generate .o

      xcrun swift -sdk $ (xcrun --show-sdk-path --sdk macosx) -c SwiftyJSON.swift -parse-as-library -module-name SwiftyJSON -v -o SwiftyJSON.o
      

      Generate .a

      ar rvs libswiftSwiftyJSON.a SwiftyJSON.o
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                ingo Ingo Muschenetz
                Reviewer:
                Christopher Williams
                Tester:
                Samir Mohammed
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-19321
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code