-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SupportsSwiftPackage</key> | ||
<true/> | ||
<key>Kind</key> | ||
<string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string> | ||
<key>SortOrder</key> | ||
<string>1</string> | ||
<key>AllowedTypes</key> | ||
<array> | ||
<string>public.swift-source</string> | ||
</array> | ||
<key>Platforms</key> | ||
<array /> | ||
<key>DefaultCompletionName</key> | ||
<string>YourService</string> | ||
</dict> | ||
</plist> |
53 changes: 53 additions & 0 deletions
53
templates/TCA Service.xctemplate/___FILEBASENAME___Service.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//___FILEHEADER___ | ||
|
||
import ComposableArchitecture | ||
|
||
protocol ___FILEBASENAMEASIDENTIFIER___ { | ||
func greeting() -> Effect<String, Never> | ||
} | ||
|
||
final class ___FILEBASENAMEASIDENTIFIER___Live: ___FILEBASENAMEASIDENTIFIER___ { | ||
func greeting() -> Effect<String, Never> { | ||
.fireAndForget { | ||
print("Hello") | ||
} | ||
} | ||
} | ||
|
||
extension ___FILEBASENAMEASIDENTIFIER___ where Self == ___FILEBASENAMEASIDENTIFIER___Live { | ||
static var live: Self { | ||
.init() | ||
} | ||
} | ||
|
||
#if DEBUG | ||
struct ___FILEBASENAMEASIDENTIFIER___Mock: ___FILEBASENAMEASIDENTIFIER___ { | ||
let greetingEffect: Effect<String, Never> | ||
|
||
func greeting() -> Effect<String, Never> { greetingEffect } | ||
} | ||
|
||
extension ___FILEBASENAMEASIDENTIFIER___ where Self == ___FILEBASENAMEASIDENTIFIER___Mock { | ||
static func mock( | ||
greeting: Effect<String, Never> = .none | ||
) -> Self { | ||
.init( | ||
greetingEffect: greeting | ||
) | ||
} | ||
|
||
static var noop: Self { | ||
.init( | ||
greetingEffect: .none | ||
) | ||
} | ||
|
||
static var failing: Self { | ||
.init( | ||
greetingEffect: .fireAndForget { | ||
fatalError("Not implemented yet") | ||
} | ||
) | ||
} | ||
} | ||
#endif |