DataType

# CGFloat

<div class="rst-class">

forsearch

</div>

DataType

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Provides an easy way to access the <span class="title-ref">CGFloat</span> type used with Mac and iOS API calls.

## Notes

When used in a 32-bit app this is an alias to Single; in a 64-bit app it is an alias to Double.

<span class="title-ref">CGFloat</span> serves as a transitionary type until only 64-bit iOS and Mac builds are supported. At that point, <span class="title-ref">CGFloat</span> will be deprecated and Double should be used in its place.

## Sample code

An iOS Declare that uses <span class="title-ref">CGFloat</span> so that it works on both 32-bit and 64-bit builds automatically:

``` xojo
Declare Function initWithComponents Lib "UIKit" Selector "initWithRed:green:blue:alpha:" _
    (obj_id As Ptr, red As CGFloat, green As CGFloat, blue As CGFloat, alpha As CGFloat) As Ptr
```

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`Double</api/data_types/double>`, `Single</api/data_types/single>`, `Declare</api/language/declare>`

</div>
