Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #14 from nallick/swift-tools-version-5
Browse files Browse the repository at this point in the history
Update SPM to swift-tools-version:5.0
  • Loading branch information
yeokm1 authored Oct 1, 2019
2 parents ddc06f5 + 29bbe85 commit 86625ee
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 11 deletions.
16 changes: 14 additions & 2 deletions Examples/SwiftSerialExample/Package.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftSerialExample",
dependencies: [
.Package(url: "https://github.com/yeokm1/SwiftSerial.git", majorVersion: 0)
]
.package(url: "https://github.com/yeokm1/SwiftSerial.git", from: "0.1.1")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "SwiftSerialExample",
dependencies: ["SwiftSerial"],
path: "Sources"
),
]
)
6 changes: 3 additions & 3 deletions Examples/SwiftSerialExample/Sources/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ do {
transmitRate: .baud9600,
minimumBytesToRead: 1)

print("Writing test string <\(testString)> of \(testString.characters.count) characters to serial port")
print("Writing test string <\(testString)> of \(testString.count) characters to serial port")

var bytesWritten = try serialPort.writeString(testString)
let bytesWritten = try serialPort.writeString(testString)

print("Successfully wrote \(bytesWritten) bytes")
print("Waiting to receive what was written...")
Expand All @@ -54,7 +54,7 @@ do {
var multiLineString: String = ""


for i in 1...numberOfMultiNewLineTest {
for _ in 1...numberOfMultiNewLineTest {
multiLineString += testString + "\n"
}

Expand Down
16 changes: 14 additions & 2 deletions Examples/SwiftSerialIM/Package.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftSerialIM",
dependencies: [
.Package(url: "https://github.com/yeokm1/SwiftSerial.git", majorVersion: 0)
]
.package(url: "https://github.com/yeokm1/SwiftSerial.git", from: "0.1.1")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "SwiftSerialIM",
dependencies: ["SwiftSerial"],
path: "Sources"
),
]
)
2 changes: 1 addition & 1 deletion Examples/SwiftSerialIM/Sources/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ do {


while true {
var enteredKey = getKeyPress()
let enteredKey = getKeyPress()
printToScreenFrom(myself: true, characterToPrint: enteredKey)
var _ = try serialPort.writeChar(enteredKey)
}
Expand Down
16 changes: 15 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftSerial"
name: "SwiftSerial",
products: [
.library(name: "SwiftSerial", targets: ["SwiftSerial"]),
],
dependencies: [],
targets: [
.target(
name: "SwiftSerial",
dependencies: [],
path: "Sources"
),
]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SwiftSerial
A Swift Linux and Mac library for reading and writing to serial ports. This library has been tested to work on macOS Sierra, Linux Mint 18 (based on Ubuntu 16.04) and on the [Raspberry Pi 3 on Ubuntu 16.04](https://wiki.ubuntu.com/ARM/RaspberryPi). Other platforms using Ubuntu like the Beaglebone might work as well.
A Swift Linux and Mac library for reading and writing to serial ports. This library has been tested to work on macOS Mojove, Linux Mint 18 (based on Ubuntu 16.04) and on the [Raspberry Pi 3 on Ubuntu 16.04](https://wiki.ubuntu.com/ARM/RaspberryPi) and Raspberry Pi 4 on Raspian Buster. Other platforms using Ubuntu like the Beaglebone might work as well.

This library is an improvement over my previous now deprecated library [SwiftLinuxSerial](https://github.com/yeokm1/SwiftLinuxSerial) which was less Swifty and supported only Linux. This library is thanks largely to [Jay Jun](https://github.com/jayjun). His original pull request can be found [here](https://github.com/yeokm1/SwiftLinuxSerial/pull/1).

Expand Down Expand Up @@ -117,7 +117,7 @@ Add SwiftSerial as a dependency to your project by editing the `Package.swift` f
let package = Package(
name: "NameOfMyProject",
dependencies: [
.Package(url: "https://github.com/yeokm1/SwiftSerial.git", majorVersion: 0),
.package(url: "https://github.com/yeokm1/SwiftSerial.git", from: "0.1.1"),
...
]
...
Expand Down

0 comments on commit 86625ee

Please sign in to comment.