Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/ci-sampleapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ github.job }}"
cancel-in-progress: true

jobs:
Expand All @@ -29,9 +29,13 @@ jobs:
- uses: actions/checkout@v4

- name: Setup Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer
run: sudo xcode-select --switch /Applications/Xcode_16.4.app
shell: bash

- name: Set Swift Syntax Prebuilts
run: |
defaults write com.apple.dt.Xcode IDEPackageEnablePrebuilts YES

- name: Run `build-for-testing`
run: |
set -o pipefail && xcodebuild build-for-testing \
Expand Down
31 changes: 26 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.head_ref || github.run_id }}
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}-${{ github.job }}"
cancel-in-progress: true

jobs:
build_and_test:
name: Build and Test
runs-on: macos-15
strategy:
matrix:
xcode: ['16.4']
config: ['Debug', 'Release']

env:
SCHEME: KarrotListKit
Expand All @@ -24,22 +29,38 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Xcode Version
run: sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer
- name: Setup Xcode ${{ matrix.xcode }}
run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.xcode }}.app
shell: bash

- name: Set Swift Syntax Prebuilts
run: |
defaults write com.apple.dt.Xcode IDEPackageEnablePrebuilts YES

- name: Run `build-for-testing`
run: |
set -o pipefail && xcodebuild build-for-testing \
-scheme "$SCHEME" \
-destination "$DESTINATION" \
-configuration Debug \
-configuration ${{ matrix.config }} \
ENABLE_TESTABILITY=YES \
| xcbeautify --renderer github-actions

- name: Run `test-without-building`
run: |
set -o pipefail && xcodebuild test-without-building \
-scheme "$SCHEME" \
-destination "$DESTINATION" \
-configuration Debug \
-configuration ${{ matrix.config }} \
ENABLE_TESTABILITY=YES \
| xcbeautify --renderer github-actions

check-macro-compatibility:
name: Check Macro Compatibility
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run Swift Macro Compatibility Check
uses: Matejkob/swift-macro-compatibility-check@v1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ struct VerticalLayoutItemComponent: Component {

let viewModel: ViewModel

@AddComponentModifier
var onTapButtonHandler: (() -> Void)?

@AddComponentModifier
var onTapButtonWithValueHandler: ((Int) -> Void)?

@AddComponentModifier
var onTapButtonWithValuesHandler: ((Int, String) -> Void)?

@AddComponentModifier
var onTapButtonWithNamedValuesHandler: ((_ intValue: Int, _ stringValue: String) -> Void)?

init(viewModel: ViewModel) {
self.viewModel = viewModel
}
Expand Down
33 changes: 20 additions & 13 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
// swift-tools-version: 5.5
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import CompilerPluginSupport
import PackageDescription

let package = Package(
name: "KarrotListKit",
platforms: [.iOS(.v13)],
platforms: [.iOS(.v13), .macOS(.v10_15)],
products: [
.library(
name: "KarrotListKit",
targets: ["KarrotListKit"]
),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-syntax.git", "509.0.0"..<"602.0.0"),
.package(
url: "https://github.com/ra1028/DifferenceKit.git",
.upToNextMajor(from: "1.0.0")
Expand All @@ -23,11 +25,26 @@ let package = Package(
name: "KarrotListKit",
dependencies: [
"DifferenceKit",
"KarrotListKitMacros",
]
),
.macro(
name: "KarrotListKitMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]
),
.testTarget(
name: "KarrotListKitTests",
dependencies: ["KarrotListKit"]
),
.testTarget(
name: "KarrotListKitMacrosTests",
dependencies: [
"KarrotListKitMacros",
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
]
),
]
)
6 changes: 4 additions & 2 deletions Sources/KarrotListKit/Adapter/CollectionViewAdapter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
//

import Combine
import UIKit

import DifferenceKit

#if canImport(UIKit)
import UIKit

/// An adapter for `UICollectionView`
///
/// The `CollectionViewAdapter` object serves as an adapter between the `UIColletionView` logic and the `KarrotListKit` logic
Expand Down Expand Up @@ -772,3 +773,4 @@ extension CollectionViewAdapter: UICollectionViewDataSource {
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) 2024 Danggeun Market Inc.
//

#if canImport(UIKit)
import UIKit

/// The configuration for the CollectionViewAdapter object.
Expand Down Expand Up @@ -67,3 +68,4 @@ extension CollectionViewAdapterConfiguration {
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (c) 2024 Danggeun Market Inc.
//

#if canImport(UIKit)
import UIKit

/// A protocol that manage data and size information for List
Expand Down Expand Up @@ -88,3 +89,4 @@ public class CollectionViewLayoutAdapter: CollectionViewLayoutAdaptable {
)
}
}
#endif
4 changes: 4 additions & 0 deletions Sources/KarrotListKit/Adapter/ComponentSizeStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import Foundation

#if canImport(UIKit)
import CoreGraphics

/// A protocol that defines the functionality for storing the sizes of components.
public protocol ComponentSizeStorage {

Expand Down Expand Up @@ -79,3 +82,4 @@ final class ComponentSizeStorageImpl: ComponentSizeStorage {
footerSizeStore[hash] = size
}
}
#endif
3 changes: 3 additions & 0 deletions Sources/KarrotListKit/Builder/CellsBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import Foundation

#if canImport(UIKit)

/// Provides a resultBuilder for creating an array of cell.
@resultBuilder
public enum CellsBuilder {
Expand Down Expand Up @@ -51,3 +53,4 @@ public enum CellsBuilder {
components.flatMap { $0 }
}
}
#endif
3 changes: 3 additions & 0 deletions Sources/KarrotListKit/Builder/SectionsBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import Foundation

#if canImport(UIKit)

/// Provides a resultBuilder for creating an array of section.
@resultBuilder
public enum SectionsBuilder {
Expand Down Expand Up @@ -43,3 +45,4 @@ public enum SectionsBuilder {
components.flatMap { $0 }
}
}
#endif
6 changes: 4 additions & 2 deletions Sources/KarrotListKit/Cell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Copyright (c) 2024 Danggeun Market Inc.
//

import UIKit

import DifferenceKit

#if canImport(UIKit)
import UIKit

/// The `Cell` that representing a UICollectionViewCell.
public struct Cell: Identifiable, ListingViewEventHandler {

Expand Down Expand Up @@ -108,3 +109,4 @@ extension Cell: Differentiable {
self == source
}
}
#endif
Loading
Loading