Skip to content

Commit cd00fa5

Browse files
committed
(chore): Add Supported Types section
1 parent 02b16f5 commit cd00fa5

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
*.DS_Store

README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@ The Scribble GYB configuration simplifies boilerplate code generation for Scribb
2222
3.4 [Loops](#loops)
2323

2424
4. [Supported Types](#supported-types)
25+
26+
4.1 [Supported Swift Types](#supported-swift-types)
27+
28+
4.2 [Supported ObjC Types](#supported-objective-c-types)
29+
30+
4.3 [Supported ObjC++ Types](#supported-objective-c-types-1)
2531

2632
5. [Using gyb_utils.py for Shared Utilities](#using-gyb-utils-py-for-shared-utilities)
2733

28-
4.1 [Declaring global variables](#declaring-global-utilities-in-gyb-utils-py)
34+
5.1 [Declaring global variables](#declaring-global-utilities-in-gyb-utils-py)
2935

30-
4.2 [Importing and Using Utilities](#importing-and-using-utilities-in-gyb-templates)
36+
5.2 [Importing and Using Utilities](#importing-and-using-utilities-in-gyb-templates)
3137

3238
6. [Using GYB with ObjC and ObjC++](#using-gyb-with-objective-c-and-objective-c++)
3339

@@ -214,6 +220,47 @@ struct User {
214220
215221
## Supported Types
216222
223+
GYB supports a variety of data types, allowing you to easily generate code with the required type annotations and variable declarations. The following types are supported:
224+
225+
### Supported Swift Types
226+
227+
| **Type** | **Description** | **Value** | **Example** |
228+
|----------------|---------------------------------------------------|---------------------------------------------|----------------------------|
229+
| `String` | Represents a sequence of characters. | N/A | `"Hello, World!"` |
230+
| `Int` | Represents a signed integer. | `-9223372036854775808` to `9223372036854775807` | `42` |
231+
| `Int8` | Represents an 8-bit signed integer. | `-128` to `127` | `Int8(127)` |
232+
| `Int16` | Represents a 16-bit signed integer. | `-32768` to `32767` | `Int16(32767)` |
233+
| `Int32` | Represents a 32-bit signed integer. | `-2147483648` to `2147483647` | `Int32(2147483647)` |
234+
| `Int64` | Represents a 64-bit signed integer. | `-9223372036854775808` to `9223372036854775807` | `Int64(9223372036854775807)` |
235+
| `UInt8` | Represents an 8-bit unsigned integer. | `0` to `255` | `UInt8(255)` |
236+
| `UInt16` | Represents a 16-bit unsigned integer. | `0` to `65535` | `UInt16(65535)` |
237+
| `UInt32` | Represents a 32-bit unsigned integer. | `0` to `4294967295` | `UInt32(4294967295)` |
238+
| `UInt64` | Represents a 64-bit unsigned integer. | `0` to `18446744073709551615` | `UInt64(18446744073709551615)` |
239+
| `Bool` | Represents a Boolean value (`true` or `false`). | `true` or `false` | `true` |
240+
| `Double` | Represents a double-precision floating-point number. | ~±1.7e308 | `3.14159` |
241+
| `Float` | Represents a single-precision floating-point number. | ~±3.4e38 | `2.71828f` |
242+
243+
### Supported Objective-C Types
244+
245+
| **Type** | **Description** | **Value** | **Example** |
246+
|----------------|---------------------------------------------------|---------------------------------------------|----------------------------|
247+
| `NSString` | Represents a string object. | N/A | `@"Hello, World!"` |
248+
| `NSInteger` | Represents a signed integer. | `-9223372036854775808` to `9223372036854775807` | `NSInteger value = 42;` |
249+
| `NSUInteger` | Represents an unsigned integer. | `0` to `18446744073709551615` | `NSUInteger count = 10;` |
250+
| `BOOL` | Represents a Boolean value (`YES` or `NO`). | `YES` or `NO` | `BOOL isActive = YES;` |
251+
| `CGFloat` | Represents a floating-point number, typically used for UI measurements. | Varies depending on the platform | `CGFloat width = 100.0;` |
252+
253+
### Supported Objective-C++ Types
254+
255+
| **Type** | **Description** | **Value** | **Example** |
256+
|----------------|---------------------------------------------------|---------------------------------------------|----------------------------|
257+
| `std::string` | Represents a string object from the C++ Standard Library. | N/A | `std::string name = "John";`|
258+
| `int` | Represents a signed integer. | `-2147483648` to `2147483647` | `int age = 30;` |
259+
| `unsigned int` | Represents an unsigned integer. | `0` to `4294967295` | `unsigned int count = 5;` |
260+
| `bool` | Represents a Boolean value (`true` or `false`). | `true` or `false` | `bool isValid = true;` |
261+
| `float` | Represents a single-precision floating-point number. | ~±3.4e38 | `float pi = 3.14f;` |
262+
| `double` | Represents a double-precision floating-point number. | ~±1.7e308 | `double e = 2.71828;` |
263+
217264
## Using gyb_utils.py for Shared Utilities
218265
219266
The `gyb_utils.py` file in the Scribble GYB configuration allows you to declare global variables, helper functions, or imports that can be reused across different GYB templates. This is especially useful when you have common logic or variables that need to be shared.

0 commit comments

Comments
 (0)