Skip to content

Commit

Permalink
Merge pull request #15 from wlsdms0122/develop
Browse files Browse the repository at this point in the history
[RELEASE] Compose/1.8.2
  • Loading branch information
wlsdms0122 authored Jul 23, 2024
2 parents fab0525 + e58dcc4 commit ae83d9d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/ComposeMacro/ComposableObjectMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ extension ComposableObjectMacro: MemberAttributeMacro {
return []
}

guard !(member.variable?.isConstant ?? false) else {
return []
}

guard member.variable?.binding?.isObservableStoredProperty ?? false else {
return []
}
Expand Down Expand Up @@ -70,6 +74,10 @@ private extension VariableDeclSyntax {
var isPrivateProperty: Bool {
modifier?.name.text == "private" && modifier?.detail?.detail.text != "set"
}

var isConstant: Bool {
bindingSpecifier.text == "let"
}
}

private extension PatternBindingListSyntax.Element {
Expand Down
13 changes: 13 additions & 0 deletions Tests/ComposeMacroTests/ComposeMacroTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ final class ComposeMacroTests: XCTestCase {
var b: Int = 0
private(set) var c: Int = 0
private var d: Int = 0
public private(set) var e: Int = 0
public let f: Int = 0
let g: Int = 0
private(set) let h: Int = 0
private let i: Int = 0
public private(set) let j: Int = 0
}
""",
expandedSource: """
Expand All @@ -47,6 +53,13 @@ final class ComposeMacroTests: XCTestCase {
@Published
private(set) var c: Int = 0
private var d: Int = 0
@Published
public private(set) var e: Int = 0
public let f: Int = 0
let g: Int = 0
private(set) let h: Int = 0
private let i: Int = 0
public private(set) let j: Int = 0
}
extension Environment: ObservableObject {
Expand Down

0 comments on commit ae83d9d

Please sign in to comment.