> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swift/type/prop/public-property.md).

# public property

[Swift](/ios/swift.md) ⟩ [type](/ios/swift/type.md) ⟩ [property](/ios/swift/type/prop.md) ⟩ public property

{% hint style="success" %}

{% endhint %}

{% tabs %}
{% tab title="💈範例" %}
{% hint style="warning" %}
'<mark style="color:blue;">`public`</mark>' modifier is <mark style="color:yellow;">redundant</mark> for [property](/ios/swift/type/prop.md)╱<mark style="color:orange;">static</mark> property╱instance method╱[initializer](/ios/swift/type/init/initializers.md)╱[operator](/ios/swift/op.md) declared in a <mark style="color:orange;">public</mark> [extension](/ios/swift/type/ext.md).
{% endhint %}

```swift
// public extension
public extension Vector2D {

    // static property
    public static var zero: Self {          // <--- ⭐️ `public`: redundant❗️
        return Self.init(x: 0, y: 0)
    }
    
    // initializer
    public init(_ x: Scalar, _ y: Scalar) {  // <--- ⭐️ `public`: redundant❗️
        self.init(x: x, y: y)
    }
    
    // property
    public var normSquared: Scalar {         // <--- ⭐️ `public`: redundant❗️
        x * x + y * y
    }
    
    // operator function
    public static func + (u: Self, v: Self) -> Self { // <--- ⭐️ `public`: redundant❗️
        return Self.init(x: u.x + v.x, y: u.y + v.y)
    }
    
    // instance method
    public func dot(_ v: Self) -> Scalar {   // <--- ⭐️ `public`: redundant❗️
        return x * v.x + y * v.y
    }
}
```

{% endtab %}

{% tab title="📘 手冊" %}
\*
{% endtab %}
{% endtabs %}
