diff --git a/templates/TCA Service.xctemplate/TemplateIcon.png b/templates/TCA Service.xctemplate/TemplateIcon.png new file mode 100644 index 0000000..e479980 Binary files /dev/null and b/templates/TCA Service.xctemplate/TemplateIcon.png differ diff --git a/templates/TCA Service.xctemplate/TemplateIcon@2x.png b/templates/TCA Service.xctemplate/TemplateIcon@2x.png new file mode 100644 index 0000000..c62414d Binary files /dev/null and b/templates/TCA Service.xctemplate/TemplateIcon@2x.png differ diff --git a/templates/TCA Service.xctemplate/TemplateInfo.plist b/templates/TCA Service.xctemplate/TemplateInfo.plist new file mode 100644 index 0000000..be3b450 --- /dev/null +++ b/templates/TCA Service.xctemplate/TemplateInfo.plist @@ -0,0 +1,20 @@ + + + + + SupportsSwiftPackage + + Kind + Xcode.IDEFoundation.TextSubstitutionFileTemplateKind + SortOrder + 1 + AllowedTypes + + public.swift-source + + Platforms + + DefaultCompletionName + YourService + + diff --git a/templates/TCA Service.xctemplate/___FILEBASENAME___Service.swift b/templates/TCA Service.xctemplate/___FILEBASENAME___Service.swift new file mode 100644 index 0000000..098bed0 --- /dev/null +++ b/templates/TCA Service.xctemplate/___FILEBASENAME___Service.swift @@ -0,0 +1,53 @@ +//___FILEHEADER___ + +import ComposableArchitecture + +protocol ___FILEBASENAMEASIDENTIFIER___ { + func greeting() -> Effect +} + +final class ___FILEBASENAMEASIDENTIFIER___Live: ___FILEBASENAMEASIDENTIFIER___ { + func greeting() -> Effect { + .fireAndForget { + print("Hello") + } + } +} + +extension ___FILEBASENAMEASIDENTIFIER___ where Self == ___FILEBASENAMEASIDENTIFIER___Live { + static var live: Self { + .init() + } +} + +#if DEBUG +struct ___FILEBASENAMEASIDENTIFIER___Mock: ___FILEBASENAMEASIDENTIFIER___ { + let greetingEffect: Effect + + func greeting() -> Effect { greetingEffect } +} + +extension ___FILEBASENAMEASIDENTIFIER___ where Self == ___FILEBASENAMEASIDENTIFIER___Mock { + static func mock( + greeting: Effect = .none + ) -> Self { + .init( + greetingEffect: greeting + ) + } + + static var noop: Self { + .init( + greetingEffect: .none + ) + } + + static var failing: Self { + .init( + greetingEffect: .fireAndForget { + fatalError("Not implemented yet") + } + ) + } +} +#endif