Author Topic: Apple Swift on Ubuntu  (Read 52851 times)

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Apple Swift on Ubuntu
« Reply #30 on: December 13, 2015, 05:37:41 PM »
How can I make your SQLite3 Swift code an include or import?

By building on the CSQlite3 module I created.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on Ubuntu
« Reply #31 on: December 13, 2015, 06:01:12 PM »
AIR,

Here is your Swift example in Script BASIC clothing.

Code: ScriptBasic
  1. IMPORT sqlite.bas
  2.  
  3. db = sqlite::OPEN("test.db")
  4.  
  5. PRINT sqlite::VERSION(),"\n"
  6.  
  7. sql = """
  8. DROP TABLE IF EXISTS Cars;
  9. CREATE TABLE Cars(Id INT, Name TEXT, Price INT);
  10. INSERT INTO Cars VALUES(1, 'Audi', 52642);
  11. INSERT INTO Cars VALUES(2, 'Mercedes', 57127);
  12. INSERT INTO Cars VALUES(3, 'Skoda', 9000);
  13. INSERT INTO Cars VALUES(4, 'Volvo', 29000);
  14. INSERT INTO Cars VALUES(5, 'Bentley', 350000);
  15. INSERT INTO Cars VALUES(6, 'Citroen', 21000);
  16. INSERT INTO Cars VALUES(7, 'Hummer', 41400);
  17. INSERT INTO Cars VALUES(8, 'Volkswagen', 21600);
  18. """
  19.  
  20. sqlite::EXECUTE(db, sql)
  21.  
  22. stmt = sqlite::QUERY(db, "SELECT Name,Price FROM Cars Order By Price DESC")
  23.  
  24. PRINTNL
  25. WHILE (sqlite::ROW(stmt) = sqlite::SQLITE3_ROW)
  26.   IF sqlite::FETCHHASH(stmt,column) THEN
  27.     PRINT column{"Name"}," ",column{"Price"},"\n"
  28.   END IF
  29. WEND
  30.  
  31. sqlite::CLOSE(db)
  32.  


jrs@laptop:~/sb/sb22/test$ time scriba sqlair.sb
3.7.12.1

Bentley 350000
Mercedes 57127
Audi 52642
Hummer 41400
Volvo 29000
Volkswagen 21600
Citroen 21000
Skoda 9000

real   0m1.232s
user   0m0.001s
sys   0m0.010s
jrs@laptop:~/sb/sb22/test$

« Last Edit: December 13, 2015, 06:05:34 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on Ubuntu
« Reply #32 on: December 14, 2015, 10:34:20 AM »
Quote
By building on the CSQlite3 module I created.

@AIR - I can't seem to figure out how to get a module built that I can import.

What's the trick?

Ideally I would like to do something like this.

Code: Text
  1.     import Foundation
  2.     import Glibc
  3.     import SQLite    
  4.      
  5.     var db: COpaquePointer = nil
  6.     var stmt: COpaquePointer = nil
  7.      
  8.     print(sqlVersion(),"\n")
  9.      
  10.     sqlOpen("test.db", database: &db)
  11.      
  12.     var sql =       "DROP TABLE IF EXISTS Cars;" +
  13.                 "CREATE TABLE Cars(Id INT, Name TEXT, Price INT);" +
  14.                 "INSERT INTO Cars VALUES(1, 'Audi', 52642);" +
  15.                 "INSERT INTO Cars VALUES(2, 'Mercedes', 57127);" +
  16.                 "INSERT INTO Cars VALUES(3, 'Skoda', 9000);" +
  17.                 "INSERT INTO Cars VALUES(4, 'Volvo', 29000);" +
  18.                 "INSERT INTO Cars VALUES(5, 'Bentley', 350000);" +
  19.                 "INSERT INTO Cars VALUES(6, 'Citroen', 21000);" +
  20.                 "INSERT INTO Cars VALUES(7, 'Hummer', 41400);" +
  21.                 "INSERT INTO Cars VALUES(8, 'Volkswagen', 21600);"
  22.      
  23.     sqlExec(db, query: sql)
  24.      
  25.     sql = "SELECT Name,Price FROM Cars Order By Price DESC"
  26.      
  27.     sqlPrepare(db, query: sql, statement: &stmt)
  28.      
  29.     while sqlStep(stmt) == SQLITE_ROW {
  30.             var make  = sqlColumnText(stmt, column: 0)
  31.             var price = sqlColumnText(stmt, column: 1)
  32.             print(make,price)
  33.      
  34.     }    
  35.      
  36.     sqlClose(db)
  37.  
     


swiftc airlite.swift -o airlite

« Last Edit: December 14, 2015, 09:13:39 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on Ubuntu
« Reply #33 on: December 14, 2015, 09:30:21 PM »
Quote from: AIR
People use Swift because a huge (<--cue Donald Trump Accent) company is behind it.  Kind of like how Objective C became popular.

Watch how Apple’s Swift evolved into an open source powerhouse

Quote from: AIR
At least with Objective C, I can drop straight C into it without having to jump through crazy hoops to get shit to work.

That's how I feel about Script BASIC. If all I'm interested is in getting something done or test a proof of concept, SB works for me. If it's not a one off project and will be distributed, then I'll take another look what is the best solution for that environment.

@AIR - Thanks for the nudge! I will take another look at NIM.
« Last Edit: December 14, 2015, 10:15:44 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on RPi
« Reply #34 on: November 17, 2019, 05:01:58 PM »
AIR,

I'm trying to build your SQLite3 example on my RPi 4B. I'm getting this error trying to to build the package.

Code: Bash
  1. pi@RPi4B:~/swift-dev/sqldemo $ swift build
  2.  
  3. /home/pi/swift-dev/sqldemo: error: package at '/home/pi/swift-dev/sqldemo' is using Swift tools version 3.1.0 which is no longer supported; consider using '// swift-tools-version:5.1' to specify the current tools version
  4. pi@RPi4B:~/swift-dev/sqldemo $
  5.  

I tried // swift-tools-version:5.1 in the package .swift but no luck. Any ideas?
« Last Edit: November 20, 2019, 03:44:48 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on RPi
« Reply #35 on: November 17, 2019, 06:29:57 PM »
I was able to update the package tools version with this command.

swift package tools-version --set-current


Now I'm stuck resolving this.

Code: Bash
  1. pi@RPi4B:~/swift-dev/sqldemo $ swift build
  2.  
  3. /home/pi/swift-dev/sqldemo: error: manifest parse error(s):
  4. /home/pi/swift-dev/sqldemo/Package.swift:7:10: error: type 'Package.Dependency' has no member 'Package'
  5.         .Package(url: "./Sqlite3", majorVersion: 1)
  6.         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  7. pi@RPi4B:~/swift-dev/sqldemo $
  8.  

« Last Edit: November 20, 2019, 03:45:09 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Apple Swift on Ubuntu
« Reply #36 on: November 17, 2019, 09:30:27 PM »
I don't so Swift, and the original code I wrote is like 5 years old. A lot has changed since then.

Maybe do sqlite with: https://perfect.org/docs/SQLite.html

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on RPi
« Reply #37 on: November 17, 2019, 09:52:23 PM »
Thanks AIR!

That link allowed me to build their getting started example package.

If seems that Swift doesn't waste anytime deprecating code.

Code: Bash
  1. pi@RPi4B:~/swift-dev $ mkdir  perfect
  2. pi@RPi4B:~/swift-dev $ cd perfect
  3. pi@RPi4B:~/swift-dev/perfect $ git clone https://github.com/PerfectlySoft/PerfectTemplate.git
  4. Cloning into 'PerfectTemplate'...
  5. remote: Enumerating objects: 3, done.
  6. remote: Counting objects: 100% (3/3), done.
  7. remote: Compressing objects: 100% (3/3), done.
  8. remote: Total 285 (delta 0), reused 1 (delta 0), pack-reused 282
  9. Receiving objects: 100% (285/285), 62.89 KiB | 2.62 MiB/s, done.
  10. Resolving deltas: 100% (141/141), done.
  11. pi@RPi4B:~/swift-dev/perfect $ cd PerfectTemplate
  12. pi@RPi4B:~/swift-dev/perfect/PerfectTemplate $ swift build
  13. Fetching https://github.com/PerfectlySoft/Perfect-HTTPServer.git
  14. Fetching https://github.com/PerfectlySoft/Perfect-Net.git
  15. Fetching https://github.com/PerfectlySoft/Perfect-HTTP.git
  16. Fetching https://github.com/PerfectlySoft/Perfect-CZlib-src.git
  17. Fetching https://github.com/PerfectlySoft/Perfect-Crypto.git
  18. Fetching https://github.com/PerfectlySoft/Perfect-LinuxBridge.git
  19. Fetching https://github.com/PerfectlySoft/Perfect-Thread.git
  20. Fetching https://github.com/PerfectlySoft/PerfectLib.git
  21. Fetching https://github.com/PerfectlySoft/Perfect-COpenSSL-Linux.git
  22. Completed resolution in 26.70s
  23. Cloning https://github.com/PerfectlySoft/Perfect-HTTPServer.git
  24. Resolving https://github.com/PerfectlySoft/Perfect-HTTPServer.git at 3.0.23
  25. Cloning https://github.com/PerfectlySoft/Perfect-COpenSSL-Linux.git
  26. Resolving https://github.com/PerfectlySoft/Perfect-COpenSSL-Linux.git at 4.0.1
  27. Cloning https://github.com/PerfectlySoft/Perfect-Net.git
  28. Resolving https://github.com/PerfectlySoft/Perfect-Net.git at 3.3.0
  29. Cloning https://github.com/PerfectlySoft/Perfect-CZlib-src.git
  30. Resolving https://github.com/PerfectlySoft/Perfect-CZlib-src.git at 0.0.4
  31. Cloning https://github.com/PerfectlySoft/Perfect-HTTP.git
  32. Resolving https://github.com/PerfectlySoft/Perfect-HTTP.git at 3.3.0
  33. Cloning https://github.com/PerfectlySoft/Perfect-LinuxBridge.git
  34. Resolving https://github.com/PerfectlySoft/Perfect-LinuxBridge.git at 3.1.0
  35. Cloning https://github.com/PerfectlySoft/Perfect-Thread.git
  36. Resolving https://github.com/PerfectlySoft/Perfect-Thread.git at 3.0.7
  37. Cloning https://github.com/PerfectlySoft/PerfectLib.git
  38. Resolving https://github.com/PerfectlySoft/PerfectLib.git at 3.1.4
  39. Cloning https://github.com/PerfectlySoft/Perfect-Crypto.git
  40. Resolving https://github.com/PerfectlySoft/Perfect-Crypto.git at 3.2.0
  41. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/PerfectLib/Sources/PerfectLib/Dir.swift:129:16: warning: 'readdir_r' is deprecated
  42.         return readdir_r(d, &dirEnt, endPtr)
  43.                ^
  44. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/PerfectLib/Sources/PerfectLib/Dir.swift:129:16: warning: 'readdir_r' is deprecated
  45.         return readdir_r(d, &dirEnt, endPtr)
  46.                ^
  47. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/PerfectLib/Sources/PerfectLib/Dir.swift:129:16: warning: 'readdir_r' is deprecated
  48.         return readdir_r(d, &dirEnt, endPtr)
  49.                ^
  50. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-Net/Sources/PerfectNet/NetUDP.swift:52:7: warning: variable 'a' was never mutated; consider changing to 'let' constant
  51.                 var a = [UInt8](repeating: 0, count: count)
  52.                 ~~~ ^
  53.                 let
  54. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-Net/Sources/PerfectNet/NetTCPSSL.swift:219:42: warning: 'TLSv1_2_method()' is deprecated
  55.                 case .tlsV1_2: newSslCtx = SSL_CTX_new(TLSv1_2_method())
  56.                                                        ^
  57. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-Net/Sources/PerfectNet/NetTCPSSL.swift:220:42: warning: 'TLSv1_1_method()' is deprecated
  58.                 case .tlsV1_1: newSslCtx = SSL_CTX_new(TLSv1_1_method())
  59.                                                        ^
  60. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-Net/Sources/PerfectNet/NetTCPSSL.swift:221:40: warning: 'TLSv1_method()' is deprecated
  61.                 case .tlsV1: newSslCtx = SSL_CTX_new(TLSv1_method())
  62.                                                      ^
  63. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-Net/Sources/PerfectNet/NetTCPSSL.swift:219:42: warning: 'TLSv1_2_method()' is deprecated
  64.                 case .tlsV1_2: newSslCtx = SSL_CTX_new(TLSv1_2_method())
  65.                                                        ^
  66. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-Net/Sources/PerfectNet/NetTCPSSL.swift:220:42: warning: 'TLSv1_1_method()' is deprecated
  67.                 case .tlsV1_1: newSslCtx = SSL_CTX_new(TLSv1_1_method())
  68.                                                        ^
  69. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-Net/Sources/PerfectNet/NetTCPSSL.swift:221:40: warning: 'TLSv1_method()' is deprecated
  70.                 case .tlsV1: newSslCtx = SSL_CTX_new(TLSv1_method())
  71.                                                      ^
  72. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPHeaders.swift:41:15: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPRequestHeader.Name' to 'Hashable' by implementing 'hash(into:)' instead
  73.                         public var hashValue: Int {
  74.                                    ^
  75. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPHeaders.swift:242:15: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPResponseHeader.Name' to 'Hashable' by implementing 'hash(into:)' instead
  76.                         public var hashValue: Int {
  77.                                    ^
  78. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPMethod.swift:67:14: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPMethod' to 'Hashable' by implementing 'hash(into:)' instead
  79.                 public var hashValue: Int {
  80.                            ^
  81. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPHeaders.swift:41:15: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPRequestHeader.Name' to 'Hashable' by implementing 'hash(into:)' instead
  82.                         public var hashValue: Int {
  83.                                    ^
  84. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPHeaders.swift:242:15: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPResponseHeader.Name' to 'Hashable' by implementing 'hash(into:)' instead
  85.                         public var hashValue: Int {
  86.                                    ^
  87. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPMethod.swift:67:14: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPMethod' to 'Hashable' by implementing 'hash(into:)' instead
  88.                 public var hashValue: Int {
  89.                            ^
  90. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPHeaders.swift:41:15: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPRequestHeader.Name' to 'Hashable' by implementing 'hash(into:)' instead
  91.                         public var hashValue: Int {
  92.                                    ^
  93. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPHeaders.swift:242:15: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPResponseHeader.Name' to 'Hashable' by implementing 'hash(into:)' instead
  94.                         public var hashValue: Int {
  95.                                    ^
  96. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPMethod.swift:67:14: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPMethod' to 'Hashable' by implementing 'hash(into:)' instead
  97.                 public var hashValue: Int {
  98.                            ^
  99. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPMethod.swift:67:14: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPMethod' to 'Hashable' by implementing 'hash(into:)' instead
  100.                 public var hashValue: Int {
  101.                            ^
  102. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTP/Sources/PerfectHTTP/HTTPMethod.swift:67:14: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTPMethod' to 'Hashable' by implementing 'hash(into:)' instead
  103.                 public var hashValue: Int {
  104.                            ^
  105. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  106.                 var hashValue: Int { return Int(net.fd.fd) }
  107.                     ^
  108. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  109.                 var hashValue: Int { return Int(net.fd.fd) }
  110.                     ^
  111. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  112.                 var hashValue: Int { return Int(net.fd.fd) }
  113.                     ^
  114. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  115.                 var hashValue: Int { return Int(net.fd.fd) }
  116.                     ^
  117. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  118.                 var hashValue: Int { return Int(net.fd.fd) }
  119.                     ^
  120. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  121.                 var hashValue: Int { return Int(net.fd.fd) }
  122.                     ^
  123. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  124.                 var hashValue: Int { return Int(net.fd.fd) }
  125.                     ^
  126. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  127.                 var hashValue: Int { return Int(net.fd.fd) }
  128.                     ^
  129. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  130.                 var hashValue: Int { return Int(net.fd.fd) }
  131.                     ^
  132. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  133.                 var hashValue: Int { return Int(net.fd.fd) }
  134.                     ^
  135. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  136.                 var hashValue: Int { return Int(net.fd.fd) }
  137.                     ^
  138. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  139.                 var hashValue: Int { return Int(net.fd.fd) }
  140.                     ^
  141. /home/pi/swift-dev/perfect/PerfectTemplate/.build/checkouts/Perfect-HTTPServer/Sources/PerfectHTTPServer/HTTP2/HTTP2Session.swift:73:7: warning: 'Hashable.hashValue' is deprecated as a protocol requirement; conform type 'HTTP2Session' to 'Hashable' by implementing 'hash(into:)' instead
  142.                 var hashValue: Int { return Int(net.fd.fd) }
  143.                     ^
  144. [80/80] Linking PerfectTemplate
  145. pi@RPi4B:~/swift-dev/perfect/PerfectTemplate $ .build/debug/PerfectTemplate
  146. [INFO] Starting HTTP server localhost on :::8181
  147.  

This is the new format of the Package.swift file.

Code: Text
  1. import PackageDescription
  2.  
  3. let package = Package(
  4.     name: "PerfectTemplate",
  5.     targets: [],
  6.     dependencies: [
  7.         .Package(url: "https://github.com/PerfectlySoft/Perfect-HTTPServer.git",
  8.             majorVersion: 3),
  9.         .Package(url: "https://github.com/PerfectlySoft/Perfect-Mustache.git",
  10.             majorVersion: 3)
  11.     ]
  12. )
  13.  
« Last Edit: November 20, 2019, 03:45:31 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on RPi
« Reply #38 on: November 18, 2019, 10:41:38 PM »
AIR,

I don't seem to have a problem building packages from the PerfectSoft site. What isn't obvious is how to install them so when I run the test scripts it finds the package based on the IMPORT statement. I have searched the PerfectSoft site and Google and the topic seems to elude me.  :-\

I know you're not a Swift fan but your Apple roots give you a huge knowledge advantage,

A question I hear over and over on the RPi forum about Swift is can apps be built on the RPi and used on the iPhone?

Any guidance would be appreciated. I think I'm close to using Swift on the RPi.
« Last Edit: November 20, 2019, 03:45:53 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on RPi
« Reply #39 on: November 19, 2019, 05:57:54 PM »
AIR,

I may have found the answer.

Quote
Now that we’ve built and tested our command line tool, let’s install it to enable it to be run from anywhere on the command line. To do that, build the tool using the release configuration, and then move the compiled binary to /usr/local/bin:

$ swift build -c release
$ cd .build/release
$ cp -f CommandLineTool /usr/local/bin/commandlinetool
« Last Edit: November 20, 2019, 03:46:11 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on RPi
« Reply #40 on: November 20, 2019, 11:22:19 AM »
I guess that doesn't work for shared object based packages. You would think installing these modules would be an important step.
« Last Edit: November 20, 2019, 03:47:40 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: Apple Swift on Ubuntu
« Reply #41 on: November 23, 2019, 09:22:59 PM »
Now you know another reason why I don't do swift.

Offline John

  • Forum Support / SB Dev
  • Posts: 3598
    • ScriptBasic Open Source Project
Re: Apple Swift on Ubuntu
« Reply #42 on: November 23, 2019, 11:46:16 PM »
A real mystery. I sent a message to the CTO of PerfectSoft asking how to install C library packages so the IMPORT will work with your scripts. Still waiting for an answer.