Skip to content

Commit 0517b8d

Browse files
authored
Merge pull request #2 from teufelaudio/master
Last update from original repo
2 parents 95d852b + dcd083f commit 0517b8d

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

CombineRextensions.podspec

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
Pod::Spec.new do |s|
3+
s.name = 'CombineRextensions'
4+
s.version = '0.1.7'
5+
s.summary = 'Useful extensions for using CombineRex in SwiftUI, such as bindings, Views and gestures'
6+
7+
s.homepage = 'https://github.com/teufelaudio/CombineRextensions'
8+
s.license = { :type => 'Apache', :text => '© 2021 Lautsprecher Teufel' }
9+
s.author = { 'Lautsprecher Teufel' => '[email protected]' }
10+
s.source = { :git => 'https://github.com/teufelaudio/CombineRextensions.git', :tag => "v#{s.version}" }
11+
12+
s.ios.deployment_target = '13.0'
13+
s.osx.deployment_target = '10.15'
14+
s.watchos.deployment_target = '6.0'
15+
s.tvos.deployment_target = '14.0'
16+
s.swift_version = '5.3'
17+
18+
s.source_files = 'Sources/**/*.swift'
19+
20+
s.dependency 'CombineRex', '~> 0.8.8'
21+
end

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let package = Package(
88
.library(name: "CombineRextensions", targets: ["CombineRextensions"])
99
],
1010
dependencies: [
11-
.package(name: "SwiftRex", url: "https://github.com/SwiftRex/SwiftRex.git", from: "0.8.4")
11+
.package(name: "SwiftRex", url: "https://github.com/SwiftRex/SwiftRex.git", from: "0.8.8")
1212
],
1313
targets: [
1414
.target(name: "CombineRextensions", dependencies: [.product(name: "CombineRex", package: "SwiftRex")])

Sources/CombineRextensions/Button+Extensions.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Copyright © 2019 Lautsprecher Teufel GmbH. All rights reserved.
77
//
88

9+
import CombineRex
910
import Foundation
1011
import SwiftRex
1112
import SwiftUI
@@ -40,6 +41,21 @@ extension Button where Label == Text {
4041
}
4142
}
4243

44+
extension Button where Label == Text {
45+
public init<ActionType, StateType>(localizedString: KeyPath<StateType, String>,
46+
viewModel: ObservableViewModel<ActionType, StateType>,
47+
action: @escaping @autoclosure () -> ActionType,
48+
file: String = #file,
49+
function: String = #function,
50+
line: UInt = #line,
51+
info: String? = nil) {
52+
let actionSource = ActionSource(file: file, function: function, line: line, info: info)
53+
self.init(viewModel.state[keyPath: localizedString], action: {
54+
viewModel.dispatch(action(), from: actionSource)
55+
})
56+
}
57+
}
58+
4359
extension Button {
4460
public init<S: StoreType>(store: S,
4561
action: @escaping @autoclosure () -> S.ActionType,

Sources/CombineRextensions/NavigationLink+Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension NavigationLink {
2222
line: UInt = #line,
2323
info: String? = nil,
2424
onOpen: @escaping (RowTag) -> Action,
25-
onClose: @escaping () -> Action,
25+
onClose: @autoclosure @escaping () -> Action,
2626
@ViewBuilder label: @escaping () -> Label
2727
) {
2828
self.init(

0 commit comments

Comments
 (0)