Questions tagged [sourcery]

Sourcery is a code generator for Swift language, built on top of Apple's own SourceKit. It extends the language abstractions to allow you to generate boilerplate code automatically.

11 questions
4
votes
2 answers

iOS Sourcery with Flutter build

Im trying to build my flutter app for iOS it has a google maps key that I want to protect and not check in to source control it needs to be buildable from azure, to achieve this I'm storing my maps key as a secret variable in azure and as a system…
martinseal1987
  • 1,862
  • 8
  • 44
  • 77
3
votes
0 answers

Create Mocks For TypeAlias with composition of Protocols using Sourcery

I was wondering if it is possible to generate mocks for Associated types using Sourcery! protocol A { } protocol B { } /// sourcery: AutoMockable typealias C = A & B If I try this nothing happens and due to this I've to create my mocks by my own,…
Shivam Gaur
  • 491
  • 5
  • 16
2
votes
1 answer

Swift Sourcery: How to get a specific associatedtype?

Given are the following Swift protocols public protocol Symbol { associatedtype Meaning } public protocol Interpretation : Symbol {} public protocol Program : Symbol where Meaning == Body.Meaning { associatedtype Body : Symbol …
2
votes
1 answer

SwiftyMocky: ShellOut encountered an error

I am facing below issue while generating mock with SwiftyMocky ╔════════════════════════╗ ║ SwiftyMocky CLI v3.5.0 ║ ╚════════════════════════╝ Running at: SomeProject Processing mock: SomeTests ... ❌ Error: ShellOut encountered…
Ankur Arya
  • 4,693
  • 5
  • 29
  • 50
2
votes
3 answers

Xcode 10, sourcery & swiftlint build phases order

After updating to Xcode 10 there are some issues with initial project configurations. The steps look like this: Generating some files using Sourcery Linting with SwiftLint Build And configuration works like this: And this was working fine in…
Jakub
  • 13,712
  • 17
  • 82
  • 139
2
votes
1 answer

Remove substring in a string with Stencil

I'm trying to play around with Sourcery to extend some library. I almost succeeded, but at some point I have a type, returned from a func and it is an optional. I want to make it non-optional instead. For this, I have to some how remove the question…
Vladyslav Zavalykhatko
  • 15,202
  • 8
  • 65
  • 100
1
vote
0 answers

Iterating over generic types in a Sourcery template / Swift-Stencil

Does anyone know if there's a way in Sourcery to get a reference to the type a generic inherits from? I'm assuming this question doesn't make immediate sense, so here's some code for what I'm trying to do: Say I have the following in Swift: public…
0
votes
0 answers

Arm sourcery codebench debugging

This is my first time using Sorcery Code bench, i'm trying debugging an application flashed in ARM cortex9 but i have this error : arm-none-eabi-sprite: RDDI failure: No connection has been made to the specified vehicle. Ensure Debug_Connect() or…
Berg
  • 1
0
votes
1 answer

How to test Contacts Framework

hi i want to test CNContacts Store since this is my first time doing test, i don't have any idea how to conduct a unit test. This the code i want to test. private func fetchContacts() { var contacts: [Contact] = [] let keys:…
ferryawijayanto
  • 569
  • 4
  • 18
0
votes
1 answer

Detect if a forloop has zero loops

I'm trying to handle a case where a forloop with a where clause results in zero loops. I've tried using set and map in various ways unsuccessfully, possibly one of those is the solution but I just couldn't get it right. {% for variable in…
Christian Fox
  • 390
  • 2
  • 15
0
votes
2 answers

Access random array element using Sourcery and Stencil

I'm doing some code generation stuff using Sourcery and Stencil. I'm trying to add an extension to all my enums that has a method that returns a random case of the enum. So, in my case, I need a way to access a random array element. I know that we…
Mo Abdul-Hameed
  • 6,030
  • 2
  • 23
  • 36