Skip to content

Commit 6b2f17c

Browse files
committed
Revert "Add CI for formatting (#33)"
This reverts commit 416dc40.
1 parent 50339b6 commit 6b2f17c

36 files changed

+107
-227
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.swift-format

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lineBreakBeforeControlFlowKeywords" : false,
1212
"lineBreakBeforeEachArgument" : false,
1313
"lineBreakBeforeEachGenericRequirement" : false,
14-
"lineLength" : 80,
14+
"lineLength" : 160,
1515
"maximumBlankLines" : 1,
1616
"multiElementCollectionTrailingCommas" : true,
1717
"noAssignmentInExpressions" : {
@@ -62,7 +62,6 @@
6262
"UseWhereClausesInForLoops" : false,
6363
"ValidateDocumentationComments" : true
6464
},
65-
"spacesBeforeEndOfLineComments": 2,
6665
"spacesAroundRangeFormationOperators" : false,
6766
"tabWidth" : 2,
6867
"version" : 1

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55
let package = Package(
66
name: "swift-matter-examples",
77
products: [
8-
.library(name: "SwiftMatterExamples", targets: ["SwiftMatterExamples"])
8+
.library(name: "SwiftMatterExamples", targets: ["SwiftMatterExamples"]),
99
],
1010
targets: [
1111
.target(name: "SwiftMatterExamples")
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
#! /bin/sh
2-
31
# Install Homebrew
42
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Sources/SwiftMatterExamples/Documentation.docc/Resources/install-esp-terminal/install-esp-terminal-01.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /bin/sh
2-
31
# Install Homebrew
42
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
53

Sources/SwiftMatterExamples/Documentation.docc/Resources/install-esp-terminal/install-esp-terminal-02.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /bin/sh
2-
31
# Install Homebrew
42
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
53

Sources/SwiftMatterExamples/Documentation.docc/Resources/install-esp-terminal/install-esp-terminal-03.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /bin/sh
2-
31
# Install Homebrew
42
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
53

Sources/SwiftMatterExamples/Documentation.docc/Resources/install-esp-terminal/install-esp-terminal-04.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /bin/sh
2-
31
# Install Homebrew
42
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
53

Sources/SwiftMatterExamples/Documentation.docc/Resources/install-esp-terminal/install-esp-terminal-05.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /bin/sh
2-
31
# Install Homebrew
42
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
53

Sources/SwiftMatterExamples/Documentation.docc/Resources/install-esp-terminal/install-esp-terminal-06.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#! /bin/sh
2-
31
# Install Homebrew
42
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
53

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-led-blink/walkthrough-example-led-blink-01.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
//
1010
//===----------------------------------------------------------------------===//
1111

12-
func main() {
12+
func app_main() {
1313
print("🏎️ Hello, Embedded Swift! (LED Blink)")
1414
}

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-led-blink/walkthrough-example-led-blink-02.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (LED Blink)")
1515
}

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-led-blink/walkthrough-example-led-blink-03.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (LED Blink)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-led-blink/walkthrough-example-led-blink-04.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (LED Blink)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-led-blink/walkthrough-example-led-blink-05.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (LED Blink)")
1515

1616
let led = LED()
@@ -21,7 +21,7 @@ func main() {
2121
sleep(1)
2222
led.enabled.toggle()
2323
if led.enabled {
24-
led.color = .hueSaturation(Int.random(in: 0..<360), 100)
24+
led.color = .hueSaturation(Int.random(in: 0 ..< 360), 100)
2525
}
2626
}
2727
}

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-01.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515
}

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-02.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-03.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-04-a.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-04-b.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-04-c.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-04.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-05.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Resources/run-example-smart-light/walkthrough-example-smart-light-06.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (Smart Light)")
1515

1616
let led = LED()

Sources/SwiftMatterExamples/Documentation.docc/Tutorials/Run-Example-LED-Blink.tutorial

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,16 @@
6464

6565
@Steps {
6666
@Step {
67-
We start the application by declaring an **`main`** function with a print statement to show the application has started.
67+
We start the application by declaring an **`app_main`** function with a print statement to show the application has started.
68+
69+
`app_main` serves the same purpose as a `main` function in a traditional user-land application and acts as the primary entry point for our firmware application.
6870

6971
@Code(name: "Main.swift", file: "walkthrough-example-led-blink-01.swift", previousFile: "walkthrough-example-led-blink-00.swift")
7072
}
7173

7274
@Step {
7375
We use the **`@_cdecl("app_main")`** attribute to generate a wrapper C symbol which is expected by ESP IDF.
74-
76+
7577
> Important: Underscored attributes, like `@_cdecl`, are unstable features of the Swift compiler and may change behavior or break between compiler versions.
7678

7779
@Code(name: "Main.swift", file: "walkthrough-example-led-blink-02.swift", previousFile: "walkthrough-example-led-blink-01.swift")

empty-template/main/Main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift!")
1515
}

empty-template/main/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
espressif/cmake_utilities:
33
version: 0.*
4-
rules: # will add "optional_component" only when all if clauses are True
4+
rules: # will add "optional_component" only when all if clauses are True
55
- if: "idf_version >=5.0"
66
- if: "target in [esp32c2]"

led-blink/main/LED.swift

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,28 +53,27 @@ final class LED {
5353
// Hue range is 0 ..< 360.
5454
var hue: Int {
5555
switch self {
56-
case .hueSaturation(let hue, _): return hue
57-
case .temperature: return 0
56+
case .hueSaturation(let hue, _): return hue
57+
case .temperature: return 0
5858
}
5959
}
6060

6161
// Saturation is 0 ... 100.
6262
var saturation: Int {
6363
switch self {
64-
case .hueSaturation(_, let saturation): return saturation
65-
case .temperature: return 0
64+
case .hueSaturation(_, let saturation): return saturation
65+
case .temperature: return 0
6666
}
6767
}
6868
}
6969

7070
var handle: led_driver_handle_t
71-
71+
7272
init() {
7373
var config = led_driver_get_config()
7474
let handle = led_driver_init(&config)
75-
guard let handle else { fatalError("Failed to initialize handle") }
7675
led_driver_set_power(handle, true)
77-
self.handle = handle
76+
self.handle = handle!
7877
}
7978

8079
}

led-blink/main/Main.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//===----------------------------------------------------------------------===//
1111

1212
@_cdecl("app_main")
13-
func main() {
13+
func app_main() {
1414
print("🏎️ Hello, Embedded Swift! (LED Blink)")
1515

1616
let led = LED()
@@ -21,7 +21,7 @@ func main() {
2121
sleep(1)
2222
led.enabled.toggle()
2323
if led.enabled {
24-
led.color = .hueSaturation(Int.random(in: 0..<360), 100)
24+
led.color = .hueSaturation(Int.random(in: 0 ..< 360), 100)
2525
}
2626
}
2727
}

led-blink/main/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dependencies:
22
espressif/cmake_utilities:
33
version: 0.*
4-
rules: # will add "optional_component" only when all if clauses are True
4+
rules: # will add "optional_component" only when all if clauses are True
55
- if: "idf_version >=5.0"
66
- if: "target in [esp32c2]"

0 commit comments

Comments
 (0)