Skip to content

Commit

Permalink
(chore): Add Supported Types section
Browse files Browse the repository at this point in the history
  • Loading branch information
N3v1 committed Oct 23, 2024
1 parent 02b16f5 commit cd00fa5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*.DS_Store
51 changes: 49 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ The Scribble GYB configuration simplifies boilerplate code generation for Scribb
3.4 [Loops](#loops)

4. [Supported Types](#supported-types)

4.1 [Supported Swift Types](#supported-swift-types)

4.2 [Supported ObjC Types](#supported-objective-c-types)

4.3 [Supported ObjC++ Types](#supported-objective-c-types-1)

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

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

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

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

Expand Down Expand Up @@ -214,6 +220,47 @@ struct User {
## Supported Types
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:
### Supported Swift Types
| **Type** | **Description** | **Value** | **Example** |
|----------------|---------------------------------------------------|---------------------------------------------|----------------------------|
| `String` | Represents a sequence of characters. | N/A | `"Hello, World!"` |
| `Int` | Represents a signed integer. | `-9223372036854775808` to `9223372036854775807` | `42` |
| `Int8` | Represents an 8-bit signed integer. | `-128` to `127` | `Int8(127)` |
| `Int16` | Represents a 16-bit signed integer. | `-32768` to `32767` | `Int16(32767)` |
| `Int32` | Represents a 32-bit signed integer. | `-2147483648` to `2147483647` | `Int32(2147483647)` |
| `Int64` | Represents a 64-bit signed integer. | `-9223372036854775808` to `9223372036854775807` | `Int64(9223372036854775807)` |
| `UInt8` | Represents an 8-bit unsigned integer. | `0` to `255` | `UInt8(255)` |
| `UInt16` | Represents a 16-bit unsigned integer. | `0` to `65535` | `UInt16(65535)` |
| `UInt32` | Represents a 32-bit unsigned integer. | `0` to `4294967295` | `UInt32(4294967295)` |
| `UInt64` | Represents a 64-bit unsigned integer. | `0` to `18446744073709551615` | `UInt64(18446744073709551615)` |
| `Bool` | Represents a Boolean value (`true` or `false`). | `true` or `false` | `true` |
| `Double` | Represents a double-precision floating-point number. | ~±1.7e308 | `3.14159` |
| `Float` | Represents a single-precision floating-point number. | ~±3.4e38 | `2.71828f` |
### Supported Objective-C Types
| **Type** | **Description** | **Value** | **Example** |
|----------------|---------------------------------------------------|---------------------------------------------|----------------------------|
| `NSString` | Represents a string object. | N/A | `@"Hello, World!"` |
| `NSInteger` | Represents a signed integer. | `-9223372036854775808` to `9223372036854775807` | `NSInteger value = 42;` |
| `NSUInteger` | Represents an unsigned integer. | `0` to `18446744073709551615` | `NSUInteger count = 10;` |
| `BOOL` | Represents a Boolean value (`YES` or `NO`). | `YES` or `NO` | `BOOL isActive = YES;` |
| `CGFloat` | Represents a floating-point number, typically used for UI measurements. | Varies depending on the platform | `CGFloat width = 100.0;` |
### Supported Objective-C++ Types
| **Type** | **Description** | **Value** | **Example** |
|----------------|---------------------------------------------------|---------------------------------------------|----------------------------|
| `std::string` | Represents a string object from the C++ Standard Library. | N/A | `std::string name = "John";`|
| `int` | Represents a signed integer. | `-2147483648` to `2147483647` | `int age = 30;` |
| `unsigned int` | Represents an unsigned integer. | `0` to `4294967295` | `unsigned int count = 5;` |
| `bool` | Represents a Boolean value (`true` or `false`). | `true` or `false` | `bool isValid = true;` |
| `float` | Represents a single-precision floating-point number. | ~±3.4e38 | `float pi = 3.14f;` |
| `double` | Represents a double-precision floating-point number. | ~±1.7e308 | `double e = 2.71828;` |
## Using gyb_utils.py for Shared Utilities
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.
Expand Down

0 comments on commit cd00fa5

Please sign in to comment.