Skip to content

Commit c3ece7b

Browse files
Merge branch 'pointfreeco:main' into dynamic2
2 parents f68c9b9 + 5e4caa8 commit c3ece7b

File tree

14 files changed

+210
-96
lines changed

14 files changed

+210
-96
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 77 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,83 +2,131 @@
22

33
## Our Pledge
44

5-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
611

7-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
814

915
## Our Standards
1016

11-
Examples of behavior that contributes to a positive environment for our community include:
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
1219

1320
* Demonstrating empathy and kindness toward other people
1421
* Being respectful of differing opinions, viewpoints, and experiences
1522
* Giving and gracefully accepting constructive feedback
16-
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17-
* Focusing on what is best not just for us as individuals, but for the overall community
23+
* Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
* Focusing on what is best not just for us as individuals, but for the overall
26+
community
1827

1928
Examples of unacceptable behavior include:
2029

21-
* The use of sexualized language or imagery, and sexual attention or
22-
advances of any kind
30+
* The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
2332
* Trolling, insulting or derogatory comments, and personal or political attacks
2433
* Public or private harassment
25-
* Publishing others' private information, such as a physical or email
26-
address, without their explicit permission
34+
* Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
2736
* Other conduct which could reasonably be considered inappropriate in a
2837
professional setting
2938

3039
## Enforcement Responsibilities
3140

32-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
3345

34-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
3550

3651
## Scope
3752

38-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
3958

4059
## Enforcement
4160

42-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [email protected]. All complaints will be reviewed and investigated promptly and fairly.
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement at
63+
64+
All complaints will be reviewed and investigated promptly and fairly.
4365

44-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
66+
All community leaders are obligated to respect the privacy and security of the
67+
reporter of any incident.
4568

4669
## Enforcement Guidelines
4770

48-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
71+
Community leaders will follow these Community Impact Guidelines in determining
72+
the consequences for any action they deem in violation of this Code of Conduct:
4973

5074
### 1. Correction
5175

52-
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
76+
**Community Impact**: Use of inappropriate language or other behavior deemed
77+
unprofessional or unwelcome in the community.
5378

54-
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
79+
**Consequence**: A private, written warning from community leaders, providing
80+
clarity around the nature of the violation and an explanation of why the
81+
behavior was inappropriate. A public apology may be requested.
5582

5683
### 2. Warning
5784

58-
**Community Impact**: A violation through a single incident or series of actions.
85+
**Community Impact**: A violation through a single incident or series of
86+
actions.
5987

60-
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
88+
**Consequence**: A warning with consequences for continued behavior. No
89+
interaction with the people involved, including unsolicited interaction with
90+
those enforcing the Code of Conduct, for a specified period of time. This
91+
includes avoiding interactions in community spaces as well as external channels
92+
like social media. Violating these terms may lead to a temporary or permanent
93+
ban.
6194

6295
### 3. Temporary Ban
6396

64-
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
97+
**Community Impact**: A serious violation of community standards, including
98+
sustained inappropriate behavior.
6599

66-
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
100+
**Consequence**: A temporary ban from any sort of interaction or public
101+
communication with the community for a specified period of time. No public or
102+
private interaction with the people involved, including unsolicited interaction
103+
with those enforcing the Code of Conduct, is allowed during this period.
104+
Violating these terms may lead to a permanent ban.
67105

68106
### 4. Permanent Ban
69107

70-
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
108+
**Community Impact**: Demonstrating a pattern of violation of community
109+
standards, including sustained inappropriate behavior, harassment of an
110+
individual, or aggression toward or disparagement of classes of individuals.
71111

72-
**Consequence**: A permanent ban from any sort of public interaction within the community.
112+
**Consequence**: A permanent ban from any sort of public interaction within the
113+
community.
73114

74115
## Attribution
75116

76-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77-
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
117+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118+
version 2.1, available at
119+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
78120

79-
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80-
81-
[homepage]: https://www.contributor-covenant.org
121+
Community Impact Guidelines were inspired by
122+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
82123

83124
For answers to common questions about this code of conduct, see the FAQ at
84-
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
125+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126+
[https://www.contributor-covenant.org/translations][translations].
127+
128+
[homepage]: https://www.contributor-covenant.org
129+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130+
[Mozilla CoC]: https://github.com/mozilla/diversity
131+
[FAQ]: https://www.contributor-covenant.org/faq
132+
[translations]: https://www.contributor-covenant.org/translations

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
blank_issues_enabled: false
22

33
contact_links:
4-
- name: Discussion
4+
- name: Project Discussion
55
url: https://github.com/pointfreeco/swift-composable-architecture/discussions
66
about: Composable Architecture Q&A, ideas, and more
77
- name: Documentation
@@ -10,3 +10,6 @@ contact_links:
1010
- name: Videos
1111
url: https://www.pointfree.co/collections/composable-architecture
1212
about: Watch videos to get a behind-the-scenes look at how the Composable Architecture was motivated and built
13+
- name: Slack
14+
url: https://www.pointfree.co/slack-invite
15+
about: Community chat

ComposableArchitecture.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.resolved

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let package = Package(
2323
.package(url: "https://github.com/pointfreeco/combine-schedulers", from: "0.8.0"),
2424
.package(url: "https://github.com/pointfreeco/swift-case-paths", from: "0.10.0"),
2525
.package(url: "https://github.com/apple/swift-collections", from: "1.0.2"),
26-
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.6.0"),
26+
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "0.7.0"),
2727
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "0.1.2"),
2828
.package(url: "https://github.com/pointfreeco/swift-identified-collections", from: "0.4.1"),
2929
.package(url: "https://github.com/pointfreeco/swiftui-navigation", from: "0.6.0"),

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# The Composable Architecture
22

33
[![CI](https://github.com/pointfreeco/swift-composable-architecture/workflows/CI/badge.svg)](https://github.com/pointfreeco/swift-composable-architecture/actions?query=workflow%3ACI)
4+
[![Slack](https://img.shields.io/badge/slack-chat-informational.svg?label=Slack&logo=slack)](https://www.pointfree.co/slack-invite)
45
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpointfreeco%2Fswift-composable-architecture%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/pointfreeco/swift-composable-architecture)
56
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fpointfreeco%2Fswift-composable-architecture%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/pointfreeco/swift-composable-architecture)
67

@@ -13,8 +14,8 @@ SwiftUI, UIKit, and more, and on any Apple platform (iOS, macOS, tvOS, and watch
1314
* [Examples](#examples)
1415
* [Basic usage](#basic-usage)
1516
* [Documentation](#documentation)
17+
* [Community](#community)
1618
* [Installation](#installation)
17-
* [Help](#help)
1819
* [Translations](#translations)
1920

2021
## What is the Composable Architecture?
@@ -581,6 +582,15 @@ comfortable with the library:
581582
* [Bindings][bindings-article]
582583
* [Migrating to the reducer protocol][migrating-article]
583584

585+
## Community
586+
587+
If you want to discuss the Composable Architecture or have a question about how to use it to solve
588+
a particular problem, there are a number of places you can discuss with fellow
589+
[Point-Free](http://www.pointfree.co) enthusiasts:
590+
591+
* For long-form discussions, we recommend the [discussions][gh-discussions] tab of this repo.
592+
* For casual chat, we recommend the [Point-Free Community slack](http://pointfree.co/slack-invite).
593+
584594
## Installation
585595

586596
You can add ComposableArchitecture to an Xcode project by adding it as a package dependency.
@@ -598,12 +608,6 @@ You can add ComposableArchitecture to an Xcode project by adding it as a package
598608
modules and consumes the static library in this fashion using the **tic-tac-toe** Swift
599609
package.
600610

601-
## Help
602-
603-
If you want to discuss the Composable Architecture or have a question about how to use it to solve
604-
a particular problem, you can start a topic in the [discussions][gh-discussions] tab of this repo,
605-
or ask around on [its Swift forum][swift-forum].
606-
607611
## Translations
608612

609613
The following translations of this README have been contributed by members of the community:

Sources/ComposableArchitecture/Store.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public final class Store<State, Action> {
326326
self.scope(state: toChildState, action: { $0 })
327327
}
328328

329-
@_spi(Internals) public func filter(
329+
func filter(
330330
_ isSent: @escaping (State, Action) -> Bool
331331
) -> Store<State, Action> {
332332
self.threadCheck(status: .scope)

Sources/ComposableArchitecture/SwiftUI/Binding.swift

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,32 @@ public struct BindingAction<Root>: Equatable {
166166

167167
@usableFromInline
168168
let set: (inout Root) -> Void
169-
let value: Any
169+
// NB: swift(<5.8) has an enum existential layout bug that can cause crashes when extracting
170+
// payloads. We can box the existential to work around the bug.
171+
#if swift(<5.8)
172+
private let _value: [Any]
173+
var value: Any { self._value[0] }
174+
#else
175+
let value: Any
176+
#endif
170177
let valueIsEqualTo: (Any) -> Bool
171178

179+
init(
180+
keyPath: PartialKeyPath<Root>,
181+
set: @escaping (inout Root) -> Void,
182+
value: Any,
183+
valueIsEqualTo: @escaping (Any) -> Bool
184+
) {
185+
self.keyPath = keyPath
186+
self.set = set
187+
#if swift(<5.8)
188+
self._value = [value]
189+
#else
190+
self.value = value
191+
#endif
192+
self.valueIsEqualTo = valueIsEqualTo
193+
}
194+
172195
public static func == (lhs: Self, rhs: Self) -> Bool {
173196
lhs.keyPath == rhs.keyPath && lhs.valueIsEqualTo(rhs.value)
174197
}

Sources/ComposableArchitecture/TestStore.swift

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,9 +1311,15 @@ extension TestStore where ScopedState: Equatable, Action: Equatable {
13111311
file: StaticString = #file,
13121312
line: UInt = #line
13131313
) {
1314+
var expectedActionDump = ""
1315+
customDump(expectedAction, to: &expectedActionDump, indent: 2)
13141316
self.receiveAction(
13151317
matching: { expectedAction == $0 },
1316-
failureMessage: #"Expected to receive an action "\#(expectedAction)", but didn't get one."#,
1318+
failureMessage: """
1319+
Expected to receive the following action, but didn't: …
1320+
1321+
\(expectedActionDump)
1322+
""",
13171323
unexpectedActionDescription: { receivedAction in
13181324
TaskResultDebugging.$emitRuntimeWarnings.withValue(false) {
13191325
diff(expectedAction, receivedAction, format: .proportional)
@@ -1768,14 +1774,14 @@ extension TestStore where ScopedState: Equatable {
17681774
}
17691775

17701776
if !actions.isEmpty {
1771-
var action = ""
1772-
customDump(actions, to: &action)
1777+
var actionsDump = ""
1778+
customDump(actions, to: &actionsDump)
17731779
XCTFailHelper(
17741780
"""
17751781
\(actions.count) received action\
17761782
\(actions.count == 1 ? " was" : "s were") skipped:
17771783
1778-
\(action)
1784+
\(actionsDump)
17791785
""",
17801786
file: file,
17811787
line: line

Tests/ComposableArchitectureTests/BindingTests.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,17 @@ final class BindingTests: XCTestCase {
4141
XCTAssertEqual(viewStore.state, .init(nested: .init(field: "Hello!")))
4242
}
4343
#endif
44+
45+
// NB: This crashes in Swift(<5.8) RELEASE when `BindingAction` holds directly onto an unboxed
46+
// `value: Any` existential
47+
func testLayoutBug() {
48+
enum Foo {
49+
case bar(Baz)
50+
}
51+
enum Baz {
52+
case fizz(BindingAction<Void>)
53+
case buzz(Bool)
54+
}
55+
_ = (/Foo.bar).extract(from: .bar(.buzz(true)))
56+
}
4457
}

0 commit comments

Comments
 (0)