Defining Stores
Stores are defined in TypeScript using *.brownie.ts files. The CLI auto-discovers these files and generates corresponding native types.
Basic Store
Create a file ending with .brownie.ts:
Key points:
- Interface must extend
BrownieStore - Register via module augmentation in
BrownieStores - Interface name becomes the store key
Nested Objects
Stores support nested object types:
Generated Swift (to node_modules/@callstack/brownie/ios/Generated/):
Multiple Stores
Define multiple stores in the same file or separate files:
Supported Types
Import the Store File
Make sure to import your .brownie.ts file in your app entry point:
This ensures TypeScript module augmentation is applied.
Store Discovery
The CLI recursively finds all *.brownie.ts files in your project (excluding node_modules). Each file is parsed to extract store definitions from the BrownieStores interface.
