Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
helje5 committed Feb 3, 2024
2 parents 7dec28f + 693e7c0 commit 7c71e4c
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 37 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Test

on:
push:
pull_request:
schedule:
- cron: "0 9 * * 6"

jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- swift:5.9.2-focal
container: ${{ matrix.image }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Swift Debug Package
run: swift build -c debug
- name: Build Swift Release Package
run: swift build -c release
nextstep:
runs-on: macos-13
steps:
- name: Select latest available Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.2.0'
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Swift Debug Package
run: swift build -c debug
- name: Build Swift Release Package
run: swift build -c release
22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
SWIFT_BUILD=swift build
SWIFT_CLEAN=swift package clean
SWIFT_BUILD_DIR=.build
SWIFT_TEST=swift test
CONFIGURATION=release

# docker config
SWIFT_BUILD_IMAGE="helje5/swift-dev:5.2.0"
CONFIGURATION=release
DOCKER_BUILD_DIR=".docker.build"
SWIFT_DOCKER_BUILD_DIR="$(DOCKER_BUILD_DIR)/x86_64-unknown-linux/$(CONFIGURATION)"
#SWIFT_BUILD_IMAGE="swift:5.5.3"
SWIFT_BUILD_IMAGE="helje5/arm64v8-swift-dev:5.5.3"
SWIFT_DOCKER_BUILD_DIR="$(DOCKER_BUILD_DIR)/aarch64-unknown-linux/$(CONFIGURATION)"
#SWIFT_DOCKER_BUILD_DIR="$(DOCKER_BUILD_DIR)/x86_64-unknown-linux/$(CONFIGURATION)"
DOCKER_BUILD_PRODUCT="$(DOCKER_BUILD_DIR)/$(TOOL_NAME)"


Expand All @@ -18,7 +21,11 @@ SWIFT_SOURCES=\
Sources/*/*/*/*.swift

all:
$(SWIFT_BUILD)
$(SWIFT_BUILD) -c $(CONFIGURATION)

# Cannot test in `release` configuration?!
test:
$(SWIFT_TEST)

clean :
$(SWIFT_CLEAN)
Expand All @@ -36,6 +43,13 @@ $(DOCKER_BUILD_PRODUCT): $(SWIFT_SOURCES)

docker-all: $(DOCKER_BUILD_PRODUCT)

docker-tests: #docker-all # doesn't help, gets rebuilt anyways
docker run --rm \
-v "$(PWD):/src" \
-v "$(PWD)/$(DOCKER_BUILD_DIR):/src/.build" \
"$(SWIFT_BUILD_IMAGE)" \
bash -c 'cd /src && swift test --enable-test-discovery -c $(CONFIGURATION)'

docker-clean:
rm -rf $(DOCKER_BUILD_PRODUCT)

Expand Down
23 changes: 1 addition & 22 deletions Sources/SwiftWebUI/Properties/Identifiable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,9 @@
// SwiftWebUI
//
// Created by Helge Heß on 06.06.19.
// Copyright © 2019-2020 Helge Heß. All rights reserved.
// Copyright © 2019-2024 Helge Heß. All rights reserved.
//

#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
// macOS 10.15, iOS 13 have Identifiable (and we require those version for
// `some` anyways.
#else // FIXME: which Swift
public protocol Identifiable {

associatedtype ID: Hashable

var id : Self.ID { get }
}

public extension Identifiable where Self: CaseIterable {
var id : Self { return self }
}

public extension Identifiable where Self: AnyObject {
// Note: This is not so great for Web content because OIDs are not webIDs.
var id: ObjectIdentifier { return ObjectIdentifier(self) }
}
#endif // Linux

extension Int: Identifiable {
public var id: Int { return self }
}
Expand Down
4 changes: 3 additions & 1 deletion Sources/SwiftWebUI/Values/ImagePaint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// Copyright © 2019-2024 Helge Heß. All rights reserved.
//

import CoreGraphics
#if canImport(CoreGraphics)
import CoreGraphics // required for init
#endif

public struct ImagePaint: Equatable {

Expand Down
7 changes: 2 additions & 5 deletions Sources/SwiftWebUI/Views/Generic/ForEach.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SwiftWebUI
//
// Created by Helge Heß on 11.06.19.
// Copyright © 2019-2020 Helge Heß. All rights reserved.
// Copyright © 2019-2024 Helge Heß. All rights reserved.
//

public struct ForEach<Data, Content: View> : DynamicViewContent
Expand All @@ -17,10 +17,7 @@ public struct ForEach<Data, Content: View> : DynamicViewContent

let content : ( Data.Element ) -> Content

public init(_ data: Data, content: @escaping ( Data.Element.ID ) -> Content) {
self.init(data, content: { value in content(value.id) })
}
init(_ data: Data, content: @escaping ( Data.Element ) -> Content) {
public init(_ data: Data, content: @escaping ( Data.Element ) -> Content) {
self.data = data
self.content = content
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/SwiftWebUI/Views/Layout/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SwiftWebUI
//
// Created by Helge Heß on 23.06.19.
// Copyright © 2019-2020 Helge Heß. All rights reserved.
// Copyright © 2019-2024 Helge Heß. All rights reserved.
//
public struct List<Selection: SelectionManager, Content: View>: View {

Expand All @@ -29,7 +29,7 @@ public extension List where Selection == Never {

init<Data, RowContent>(_ data: Data,
@ViewBuilder rowContent:
@escaping ( Data.Element.ID ) -> RowContent)
@escaping ( Data.Element ) -> RowContent)
where Content == ForEach<Data, HStack<RowContent>>,
Data : RandomAccessCollection,
Data.Element : Identifiable,
Expand All @@ -45,8 +45,8 @@ public extension List where Selection == Never {

init<Data, RowContent>(
_ data: Data,
action: @escaping ( Data.Element.ID ) -> Void,
@ViewBuilder rowContent: @escaping ( Data.Element.ID ) -> RowContent
action: @escaping ( Data.Element ) -> Void,
@ViewBuilder rowContent: @escaping ( Data.Element ) -> RowContent
)
where Content == ForEach<Data, AnyView>,
Data : RandomAccessCollection,
Expand Down
4 changes: 3 additions & 1 deletion Sources/SwiftWebUI/Views/Unsplash/Unsplash.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// Copyright © 2019-2024 Helge Heß. All rights reserved.
//

import CoreGraphics
#if canImport(CoreGraphics)
import CoreGraphics // required for init
#endif

extension Image {

Expand Down

0 comments on commit 7c71e4c

Please sign in to comment.