Skip to content

Commit 32ccacb

Browse files
committed
Correct spelling.
1 parent ad6665b commit 32ccacb

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright © 2021 BB9z
3+
Copyright © 2021-2022 BB9z
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
[![Build Status](https://img.shields.io/github/workflow/status/b9swift/Action/Swift?style=flat-square&colorA=555555&colorB=F05138)](https://github.com/b9swift/Action/actions)
66
[![gitee 镜像](https://img.shields.io/badge/%E9%95%9C%E5%83%8F-gitee-C61E22.svg?style=flat-square)](https://gitee.com/b9swift/Action)
77

8-
A simple base component whose main purpose is to provide a unified interface for target/selector patterns and block calls.
8+
A simple foundational component, primarily intended to provide a uniform interface for target/selector patterns and block invocations.
99

1010
## Installation
1111

12-
Using Swift Package Manager or import manually.
12+
Using Swift Package Manager or importing manually.
1313

1414
你也可以使用 [gitee 镜像](https://gitee.com/b9swift/Action)

Sources/B9Action/B9Action.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
B9Action.swift
33

4-
Copyright © 2021 BB9z.
4+
Copyright © 2021-2022 BB9z.
55
https://github.com/b9swift/Action
66

77
The MIT License
@@ -11,7 +11,7 @@
1111
import Foundation
1212

1313
/**
14-
A simple base component whose main purpose is to provide a unified interface for target/selector patterns and block calls.
14+
A simple foundational component, primarily intended to provide a uniform interface for target/selector patterns and block invocations.
1515
*/
1616
public final class Action {
1717
/// The object that receives the selector message when the action is triggered.
@@ -57,7 +57,7 @@ public final class Action {
5757
///
5858
/// - Parameter obj: An object sent with the selector message to the target, ignored when the closure is called.
5959
public func perform(with obj: Any?) {
60-
guard isVaild else { return }
60+
guard isValid else { return }
6161
if let selector = selector {
6262
_ = target?.perform(selector, with: obj)
6363
}
@@ -69,7 +69,7 @@ public final class Action {
6969
/// Whether this action is still or not. Execute the perform method with no action if the action is invalid.
7070
///
7171
/// If a reference object is set during initialization, it is valid only when the reference is not released.
72-
public var isVaild: Bool {
72+
public var isValid: Bool {
7373
if hasReferenceSet, reference == nil { return false }
7474
return true
7575
}
@@ -88,7 +88,7 @@ extension Action {
8888
if #available(iOS 10.0, *) {
8989
dispatchPrecondition(condition: .onQueue(.main))
9090
}
91-
guard isVaild else { return }
91+
guard isValid else { return }
9292
if let selector = selector {
9393
UIApplication.shared.sendAction(selector, to: target, from: sender, for: nil)
9494
}
@@ -111,7 +111,7 @@ extension Action {
111111
if #available(macOS 10.12, *) {
112112
dispatchPrecondition(condition: .onQueue(.main))
113113
}
114-
guard isVaild else { return }
114+
guard isValid else { return }
115115
if let selector = selector {
116116
NSApp.sendAction(selector, to: target, from: sender)
117117
}
@@ -125,14 +125,14 @@ extension Action {
125125

126126
extension Action: CustomDebugStringConvertible {
127127
public var debugDescription: String {
128-
let properties: [(String, Any?)] = [("target", target), ("selector", selector), ("block", block), ("reference", reference), ("isVaild", isVaild)]
129-
let propertyDiscription = properties.compactMap { key, value in
128+
let properties: [(String, Any?)] = [("target", target), ("selector", selector), ("block", block), ("reference", reference), ("isValid", isValid)]
129+
let propertyDescription = properties.compactMap { key, value in
130130
if let value = value {
131131
return "\(key) = \(value)"
132132
}
133133
return nil
134134
}.joined(separator: ", ")
135-
return "<Action \(Unmanaged.passUnretained(self).toOpaque()): \(propertyDiscription)>"
135+
return "<Action \(Unmanaged.passUnretained(self).toOpaque()): \(propertyDescription)>"
136136
}
137137
}
138138

Tests/B9ActionTests/B9ActionTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ class Counter {
1616

1717
final class B9ActionTests: XCTestCase {
1818

19-
func testBecomeInvaildAfterRefrenceReleased() {
19+
func testBecomeInvalidAfterReferenceReleased() {
2020
var action: Action!
2121

2222
do {
2323
let object = NSObject()
2424
action = Action({
2525
XCTAssert(false, "Should not be executed")
2626
}, reference: object)
27-
XCTAssertTrue(action.isVaild)
27+
XCTAssertTrue(action.isValid)
2828
}
29-
XCTAssertFalse(action.isVaild, "Should be invalid after reference released")
29+
XCTAssertFalse(action.isValid, "Should be invalid after reference released")
3030
action.perform(with: nil)
3131
}
3232

33-
func testAlwaysVaildIfNoSetRefrence() {
33+
func testAlwaysValidIfNoSetReference() {
3434
let expectation = XCTestExpectation(description: "")
3535
let target = OCTarget()
3636
let action = Action(target: target, selector: #selector(OCTarget.fill(expectation:)))
37-
XCTAssertTrue(action.isVaild)
37+
XCTAssertTrue(action.isValid)
3838
action.perform(with: expectation)
3939
wait(for: [expectation], timeout: 0)
4040
}

0 commit comments

Comments
 (0)