### SpriteView Initializers Using Options Source: https://developer.apple.com/documentation/spritekit/spriteview/options Examples of SpriteView initializers that accept SpriteView.Options to customize rendering and behavior. ```APIDOC ## SpriteView Initializers with Options ### See Also #### Creating a Sprite View `init(scene: SKScene, transition: SKTransition?, isPaused: Bool, preferredFramesPerSecond: Int, options: SpriteView.Options, shouldRender: (TimeInterval) -> Bool)` `init(scene: SKScene, transition: SKTransition?, isPaused: Bool, preferredFramesPerSecond: Int, options: SpriteView.Options, debugOptions: SpriteView.DebugOptions, shouldRender: (TimeInterval) -> Bool)` ``` -------------------------------- ### Play Video Source: https://developer.apple.com/documentation/spritekit/skvideonode Starts video playback. Call this method to begin playing the video content. ```swift func play() ``` -------------------------------- ### Get and Set Particle Z Position Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlezposition Use this property to get or set the average starting depth of a particle. The default value is 0.0. ```swift var particleZPosition: CGFloat { get set } ``` -------------------------------- ### Get and Set Particle Position Source: https://developer.apple.com/documentation/spritekit/skemitternode/particleposition Use this property to get or set the average starting position for a particle. The default value is (0.0, 0.0). ```swift var particlePosition: CGPoint { get set } ``` -------------------------------- ### SKAudioNode init(URL:) Source: https://developer.apple.com/documentation/spritekit/skaudionode/init%28url%3A%29-5bmrl Initializes an audio node with the audio data from the specified URL. ```APIDOC ## SKAudioNode init(URL:) ### Description Initializes an audio node with the audio data from the specified URL. ### Parameters #### Path Parameters - **url** (URL) - Required - The URL of the audio file. ``` -------------------------------- ### Get and Set Particle Alpha Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlealpha Use this property to get or set the average starting alpha value for a particle. The default value is 1.0. ```swift var particleAlpha: CGFloat { get set } ``` -------------------------------- ### Instance Method: sceneDidLoad() Source: https://developer.apple.com/documentation/spritekit/skscene/scenedidload%28%29 This method is called when the scene is presented. It's the preferred place to perform custom setup after the scene has been initialized or decoded. This method is intended to be overridden in a subclass. ```APIDOC ## Instance Method: sceneDidLoad() ### Description Tells you when the scene is presented. This method is intended to be overridden in a subclass. It is the preferred location to perform custom setup after the scene has been initialized or decoded. ### Method `func sceneDidLoad()` ### Availability iOS 10.0+ iPadOS 10.0+ Mac Catalyst 13.1+ macOS 10.12+ tvOS 10.0+ visionOS 1.0+ watchOS 3.0+ ### See Also - `func didChangeSize(CGSize)` - `func willMove(from: SKView)` - `func didMove(to: SKView)` ``` -------------------------------- ### init(url:) Source: https://developer.apple.com/documentation/spritekit/skaudionode/init%28url%3A%29-8v3q0 Initializes an audio node from an audio asset with the specified URL. This initializer is available on iOS 9.0+, iPadOS 9.0+, Mac Catalyst 13.1+, macOS 10.11+, tvOS 9.0+, visionOS 1.0+, and watchOS 2.0+. ```APIDOC ## init(url:) ### Description Initializes an audio node from an audio asset with the specified URL. ### Method `convenience init(url: URL)` ### Parameters #### Path Parameters - **url** (URL) - Required - The URL of an audio file. ### Response #### Success Response - A newly initialized audio node. ### See Also - `init(avAudioNode: AVAudioNode?)` - `init(fileNamed: String)` - `init?(coder: NSCoder)` ``` -------------------------------- ### Get and Set accessibilitySubrole Source: https://developer.apple.com/documentation/spritekit/sknode/accessibilitysubrole This property is used to get or set a string that defines the subrole of a user interface element. For example, it can specify a full-screen button. ```swift var accessibilitySubrole: String? { get set } ``` -------------------------------- ### Initialize and Play Video Node (Swift) Source: https://developer.apple.com/documentation/spritekit/adding-a-video-to-a-scene Initializes an SKVideoNode with a video file from the app bundle, adds it to the scene, and starts playback. Ensure the video file is included in your app's resources. ```swift let sample = SKVideoNode(fileNamed: "sample.mov") sample.position = CGPoint(x: frame.midX, y: frame.midY) addChild(sample) sample.play() ``` -------------------------------- ### Get Keyframe Count Source: https://developer.apple.com/documentation/spritekit/skkeyframesequence/count%28%29 Returns the total number of keyframes stored within the SKKeyframeSequence. No setup is required to use this method. ```swift func count() -> Int ``` -------------------------------- ### Creating an SKVideoNode with AVPlayer Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28avplayer%3A%29-9ydbu Demonstrates how to create an `SKVideoNode` using an `AVPlayer` object. Ensure the video file exists in the app bundle. ```swift var videoNode: SKVideoNode? = { guard let urlString = Bundle.main.path(forResource: "sample", ofType: "mov") else { return nil } let url = URL(fileURLWithPath: urlString) let item = AVPlayerItem(url: url) let player = AVPlayer(playerItem: item) return SKVideoNode(avPlayer: player) }() ``` -------------------------------- ### Get and Set Particle Red Color Range Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlecolorredrange Use this property to get or set the range of allowed random values for the red component of a particle’s initial color. The default value is 0.0. If non-zero, the starting red component is randomly determined within half of the specified range. ```swift var particleColorRedRange: CGFloat { get set } ``` -------------------------------- ### Create SKRange with Lower Limit Source: https://developer.apple.com/documentation/spritekit/skrange/init%28lowerlimit%3A%29 Use this initializer to create a range that starts at a specific value and extends to positive infinity. No specific setup or imports are required beyond standard Swift. ```swift convenience init(lowerLimit lower: CGFloat) ``` -------------------------------- ### Initialize and Play Video Node (Objective-C) Source: https://developer.apple.com/documentation/spritekit/adding-a-video-to-a-scene Initializes an SKVideoNode with a video file from the app bundle, adds it to the scene, and starts playback. Ensure the video file is included in your app's resources. ```objectivec SKVideoNode *sample = [SKVideoNode videoNodeWithFileNamed:@"sample.mov"]; sample.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); [self addChild: sample]; [sample play]; ``` -------------------------------- ### SKAudioNode Initializer: init(fileNamed:) Source: https://developer.apple.com/documentation/spritekit/skaudionode/init%28filenamed%3A%29 Initializes an audio node from an audio asset with the specified filename. The file must be located in the main bundle. ```APIDOC ## init(fileNamed:) ### Description Initializes an audio node from an audio asset with the specified filename. ### Method `convenience init` ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) An initialized `SKAudioNode` object. #### Response Example None ### Parameters - **name** (String) - Required - A file containing an `AVAudioNode`. ### Return Value A newly initialized audio node. ### Discussion The named file containing the audio asset must reside within the main bundle. ### See Also - `init(avAudioNode: AVAudioNode?)` - `init(url: URL)` - `init?(coder: NSCoder)` ``` -------------------------------- ### Calculate Accumulated Frame of a Node Source: https://developer.apple.com/documentation/spritekit/sknode/calculateaccumulatedframe%28%29 Use this method to get the bounding box of a node and its children, accounting for transformations. This example demonstrates displaying the bounding box of a shape node with a rotated child. ```swift let parentNode = SKShapeNode(rectOf: CGSize(width: 500, height: 500)) parentNode.lineWidth = 2 parentNode.strokeColor = .blue parentNode.fillColor = .clear let childNode = SKShapeNode(rectOf: CGSize(width: 400, height: 400)) childNode.strokeColor = .red childNode.fillColor = .clear childNode.zRotation = -CGFloat.pi / 6 // pi / 6 = 30° parentNode.addChild(childNode) let boundingBoxNode = SKShapeNode(rectOf: parentNode.calculateAccumulatedFrame().size)oundingBoxNode.lineWidth = 1oundingBoxNode.strokeColor = .blackoundingBoxNode.fillColor = .clearoundingBoxNode.path = boundingBoxNode.path?.copy(dashingWithPhase: 0, lengths: [10,10]) parentNode.addChild(boundingBoxNode) ``` -------------------------------- ### Get and Set particleColorBlendFactor Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlecolorblendfactor This property controls the average starting value for the color blend factor. The default value is 0.0, meaning the texture is used as is. A value of 1.0 results in the particle rendering with a full-tint color. ```swift var particleColorBlendFactor: CGFloat { get set } ``` -------------------------------- ### Initialize SKAudioNode from URL Source: https://developer.apple.com/documentation/spritekit/skaudionode Initializes an audio node from an audio asset located at a specified URL. ```swift convenience init(url: URL) ``` -------------------------------- ### init(ciFilter:duration:) Source: https://developer.apple.com/documentation/spritekit/sktransition/init%28cifilter%3Aduration%3A%29-451za Creates a transition that uses a Core Image filter to perform the transition. The filter must require only two image parameters (`inputImage`, `inputTargetImage`) and generate a single image (`outputImage`). The transition automatically sets `inputImage`, `inputTargetImage`, and `inputTime` properties. ```APIDOC ## init(ciFilter:duration:) ### Description Creates a transition that uses a Core Image filter to perform the transition. ### Parameters #### Path Parameters - **filter** (CIFilter) - Required - A Core Image filter. - **duration** (TimeInterval) - Required - The duration of the transition. ### Return Value A new transition. ### Discussion The filter used to perform the transition must be a filter that requires only two image parameters (`inputImage`, `inputTargetImage`) and generates a single image (`outputImage`). The transition automatically sets the filter’s `inputImage`, `inputTargetImage`, and `inputTime` properties. You must set up any other filter properties before creating the transition. ``` -------------------------------- ### Get and Set Particle Alpha Range Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlealpharange Use this property to define the random variation for a particle's starting alpha value. If non-zero, the initial alpha is randomly determined within half the range above and below the average. ```swift var particleAlphaRange: CGFloat { get set } ``` -------------------------------- ### Get and Set Particle Size Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlesize Use this property to define the starting dimensions of each particle emitted by an SKEmitterNode. The default value is CGSizeZero, in which case the particleTexture's size is used. If no texture is set, this property must be explicitly set. ```swift var particleSize: CGSize { get set } ``` -------------------------------- ### Initialize SKAudioNode from File Name Source: https://developer.apple.com/documentation/spritekit/skaudionode Initializes an audio node from an audio asset specified by its filename. ```swift convenience init(fileNamed: String) ``` -------------------------------- ### SKVideoNode Initializers Source: https://developer.apple.com/documentation/spritekit/skvideonode Initializes an SKVideoNode with different sources for video content. ```APIDOC ## Initializers ### `init(avPlayer: AVPlayer)` Initializes a video node using an existing `AVPlayer` object. ### `init(fileNamed: String)` Initializes a video node using a video file stored in the app bundle. ### `init(url: URL)` Initializes a video node using a URL. ### `init?(coder: NSCoder)` Tells you when to initialize a video node that was created from an archive. ### `init(videoFileNamed: String)` Initializes a video node using a video file stored in the app bundle. ### `init(videoURL: URL)` Initializes a video node using a URL that points to a video file. ``` -------------------------------- ### Get and Set Particle Color Blend Factor Range Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlecolorblendfactorrange Use this property to define the range of random values for a particle's starting color blend factor. If non-zero, the initial color blend factor is randomly determined within half the range above and below the average value. The default value is 0.0. ```swift var particleColorBlendFactorRange: CGFloat { get set } ``` -------------------------------- ### Get adjacencyDownEdge Mask Source: https://developer.apple.com/documentation/spritekit/sktileadjacencymask/adjacencydownedge Use this static property to get the mask representing the down edge adjacency for tile connections. ```swift static var adjacencyDownEdge: SKTileAdjacencyMask { get } ``` -------------------------------- ### Start Video Playback with play() Source: https://developer.apple.com/documentation/spritekit/skvideonode/play%28%29 Call this method on an SKVideoNode instance to begin playing the associated video. Ensure JavaScript is enabled in your browser for interactive content. ```swift func play() ``` -------------------------------- ### init(cgImage:) Source: https://developer.apple.com/documentation/spritekit/sktexture/init%28cgimage%3A%29-27ovb Creates a new texture object from a Quartz 2D image. The image data is copied before control is returned. ```APIDOC ## init(cgImage:) ### Description Create a new texture object from a Quartz 2D image. ### Method `convenience init(cgImage: CGImage)` ### Parameters #### Parameters - **image** (CGImage) - A Quartz 2D image (`CGImage`) object. For more information, see Quartz 2D Programming Guide and `CGImage`. ### Return Value A new texture object. ### Discussion The image data is copied before control is returned to your game. ### See Also - `convenience init(image: UIImage)` ``` -------------------------------- ### Get and Set zRotation Source: https://developer.apple.com/documentation/spritekit/sknode/xscale Access the zRotation property to get or set the Euler rotation about the z-axis in radians for a node. ```swift var zRotation: CGFloat ``` -------------------------------- ### Get and Set particleBlendMode Source: https://developer.apple.com/documentation/spritekit/skemitternode/particleblendmode Use this property to get or set the blending mode for particles. The default value is SKBlendMode.alpha. ```swift var particleBlendMode: SKBlendMode { get set } ``` -------------------------------- ### Initialize SKAudioNode with Filename Source: https://developer.apple.com/documentation/spritekit/skaudionode/init%28filenamed%3A%29 Use this initializer to create an audio node from an audio asset file. The file must be located in the main bundle. ```swift convenience init(fileNamed name: String) ``` -------------------------------- ### Get and Set zPosition Source: https://developer.apple.com/documentation/spritekit/sknode/zposition Use this property to get or set the height of a node relative to its parent. The default value is 0.0. ```swift var zPosition: CGFloat { get set } ``` -------------------------------- ### init(URL:) Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28url%3A%29-8rxuu Initializes an SKVideoNode with a specified video URL. This initializer is available on iOS 9.0+, iPadOS 9.0+, Mac Catalyst 13.1+, macOS 10.11+, tvOS 9.0+, visionOS 1.0+, and watchOS 2.0+. ```APIDOC ## init(URL:) ### Description Initializes an SKVideoNode with a specified video URL. ### Parameters #### Path Parameters - **videoURL** (URL) - Required - The URL of the video to be played by the node. ``` -------------------------------- ### Initialize SKVideoNode with Video URL (Deprecated) Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28videourl%3A%29 Use this initializer to create an SKVideoNode from a URL pointing to a video file. This method is deprecated; use init(url:) instead. ```swift init(videoURL url: URL) ``` -------------------------------- ### Get and Set xRotation Source: https://developer.apple.com/documentation/spritekit/sktransformnode/xrotation Use this property to get or set the rotation of a node around the X-axis. It takes and returns a CGFloat value. ```swift var xRotation: CGFloat { get set } ``` -------------------------------- ### Get and Set lineJoin Property Source: https://developer.apple.com/documentation/spritekit/skshapenode/linejoin Use this property to get or set the junction type for stroked shapes. The default value is CGLineJoin.bevel. ```swift var lineJoin: CGLineJoin { get set } ``` -------------------------------- ### Initialize SKVideoNode with Video URL (Deprecated) Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28filenamed%3A%29 This is a deprecated initializer for creating a video node from a URL pointing to a video file. Use `init(url:)` instead. ```swift init(videoURL: URL) ``` -------------------------------- ### init(URL:) Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28url%3A%29-49ou9 Initializes an SKVideoNode with a specified URL. This method is available on iOS 8.0+, iPadOS 8.0+, Mac Catalyst 13.1+, macOS 10.10+, tvOS 9.0+, visionOS 1.0+, and watchOS 1.0+. ```APIDOC ## init(URL:) ### Description Initializes an SKVideoNode with a specified URL. This is the primary way to create a video node that plays content from a given URL. ### Platforms and Versions iOS 8.0+ iPadOS 8.0+ Mac Catalyst 13.1+ macOS 10.10+ tvOS 9.0+ visionOS 1.0+ watchOS 1.0+ ### Method Signature ```swift init(URL url: URL) ``` ``` -------------------------------- ### Get and Set lowerDistanceLimit Source: https://developer.apple.com/documentation/spritekit/skphysicsjointsliding/lowerdistancelimit Use this property to get or set the smallest distance allowed for the sliding joint. The default value is 0.0. ```swift var lowerDistanceLimit: CGFloat { get set } ``` -------------------------------- ### Create an SKWarpGeometryGrid Instance Source: https://developer.apple.com/documentation/spritekit/animate-the-warping-of-a-sprite Initialize an `SKWarpGeometryGrid` using the defined source and destination vertex positions, along with the number of columns and rows. ```swift let warpGeometryGrid = SKWarpGeometryGrid(columns: 2, rows: 2, sourcePositions: sourcePositions, destinationPositions: destinationPositions) ``` -------------------------------- ### Get and Set zRotation Source: https://developer.apple.com/documentation/spritekit/sknode/zrotation Use this property to get or set the Euler rotation of a node about the z-axis in radians. The default value is 0.0. ```swift var zRotation: CGFloat { get set } ``` -------------------------------- ### Get and Set Interpolation Mode Source: https://developer.apple.com/documentation/spritekit/skkeyframesequence/interpolationmode Use this property to get or set the interpolation mode for a keyframe sequence. The default value is SKInterpolationMode.linear. ```swift var interpolationMode: SKInterpolationMode { get set } ``` -------------------------------- ### Initialize SKVideoNode with URL Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28coder%3A%29 Initializes a video node using a URL. This can be a local file URL or a remote URL. ```swift `init(url: URL)` ``` -------------------------------- ### Get and Set particleZPositionSpeed Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlezpositionspeed Use this property to get or set the speed at which a particle's depth changes. The default value is 0.0. ```swift var particleZPositionSpeed: CGFloat { get set } ``` -------------------------------- ### init(avPlayer:) Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28avplayer%3A%29-9ydbu Initializes a video node using an existing AVPlayer object. This allows for custom control over video playback. ```APIDOC ## init(avPlayer:) ### Description Initializes a video node using an existing `AVPlayer` object. ### Method Initializer ### Parameters #### Path Parameters - **player** (AVPlayer) - Required - A player object. ### Return Value An initialized video node. ### Discussion You can use the `AVPlayer` object to control playback. ### Example ```swift var videoNode: SKVideoNode? = { guard let urlString = Bundle.main.path(forResource: "sample", ofType: "mov") else { return nil } let url = URL(fileURLWithPath: urlString) let item = AVPlayerItem(url: url) let player = AVPlayer(playerItem: item) return SKVideoNode(avPlayer: player) }() ``` ``` -------------------------------- ### SKVideoNode init(videoURL:) Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28videourl%3A%29 Initializes a video node using a URL that points to a video file. This initializer is deprecated. ```APIDOC ## init(videoURL:) ### Description Initializes a video node using a URL that points to a video file. ### Method Initializer ### Endpoint N/A (This is an initializer, not an API endpoint) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) An initialized video node. #### Response Example N/A ### Deprecation This initializer is deprecated. Use `init(url:)` instead. ``` -------------------------------- ### Get and Set Fill Color (macOS) Source: https://developer.apple.com/documentation/spritekit/skshapenode/fillcolor Use this to get or set the fill color for an SKShapeNode on macOS. The default fill color is clear. ```swift var fillColor: NSColor { get set } ``` -------------------------------- ### Initialize Node from File Source: https://developer.apple.com/documentation/spritekit/sknode/init%28filenamed%3A%29 Use this initializer to create a node by loading an archive file (e.g., a .sks file) from your app's main bundle. Ensure the file exists and has the correct extension. ```swift convenience init?(fileNamed filename: String) ``` -------------------------------- ### Get and Set SKScene Size Source: https://developer.apple.com/documentation/spritekit/skscene/size Use this property to get or set the dimensions of the scene in points. Changes to the size will trigger the `didChangeSize(_:)` method. ```swift var size: CGSize { get set } ``` -------------------------------- ### Get and Set yScale Source: https://developer.apple.com/documentation/spritekit/sknode/xscale Access the yScale property to get or set the vertical scaling factor for a node and its children. The default value is 1.0. ```swift var yScale: CGFloat { get set } ``` -------------------------------- ### init(CGImage:) Source: https://developer.apple.com/documentation/spritekit/sktexture/init%28cgimage%3A%29-4ypk Initializes a new SKTexture object using a provided Core Graphics image. This is a convenience initializer. ```APIDOC ## init(CGImage:) ### Description Initializes a new texture object with a Core Graphics image. ### Method `convenience init` ### Parameters #### Parameters - **image** (CGImage) - The Core Graphics image to use for the texture. ``` -------------------------------- ### Initialize SKVideoNode with Video File Name Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28coder%3A%29 Initializes a video node using a video file stored in the app bundle. This is an alternative to `init(fileNamed:)`. ```swift `init(videoFileNamed: String)` ``` -------------------------------- ### Get and Set xScale Source: https://developer.apple.com/documentation/spritekit/sknode/xscale Access the xScale property to get or set the horizontal scaling factor for a node and its children. The default value is 1.0. ```swift var xScale: CGFloat { get set } ``` -------------------------------- ### Initialize SKVideoNode with Video URL (Deprecated) Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28coder%3A%29 Initializes a video node using a URL that points to a video file. This method is deprecated; use `init(url:)` instead. ```swift `init(videoURL: URL)` ``` -------------------------------- ### Get and Set focusBehavior for SKNode Source: https://developer.apple.com/documentation/spritekit/sknode/focusbehavior Use this property to get or set the focus behavior for an SKNode. This controls how the node responds to focus events. ```swift var focusBehavior: SKNodeFocusBehavior { get set } ``` -------------------------------- ### Get and Set accessibilityFrame Source: https://developer.apple.com/documentation/spritekit/sknode/accessibilityframe Use this property to get or set the size of a user interface element in screen points. This is crucial for accessibility features. ```swift var accessibilityFrame: CGRect { get set } ``` -------------------------------- ### SKWarpGeometry Initializers Source: https://developer.apple.com/documentation/spritekit/skwarpgeometry Provides information on how to initialize an SKWarpGeometry object. ```APIDOC ## init?(coder: NSCoder) ### Description Initializes a new instance of the SKWarpGeometry class using a coder. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) An initialized SKWarpGeometry object. #### Response Example None ``` -------------------------------- ### Get and Set Particle Scale Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlescale Use this property to get or set the average initial scale factor of a particle. The default value is 1.0. ```swift var particleScale: CGFloat { get set } ``` -------------------------------- ### Get Texture Rectangle Source: https://developer.apple.com/documentation/spritekit/sktexture/texturerect%28%29 Use this method to get the rectangle that defines the portion of the texture used for rendering. The default value covers the entire texture. ```swift func textureRect() -> CGRect ``` -------------------------------- ### Initialize SKVideoNode with File Name Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28coder%3A%29 Initializes a video node using a video file stored in the app bundle. Ensure the video file is added to your project's bundle. ```swift `init(fileNamed: String)` ``` -------------------------------- ### Create and Run a Named Action (Objective-C) Source: https://developer.apple.com/documentation/spritekit/controlling-actions-precisely-by-using-names Use `runAction:withKey:` to start an action with a unique identifier. If an action with the same key is already running, it will be replaced. ```objectivec SKAction *moveNodeRight = [SKAction moveByX:100.0 y:0.0 duration:1.0]; [spaceship runAction: moveNodeRight withKey:@"ignition"]; ``` -------------------------------- ### Get and Set Horizontal Alignment Mode Source: https://developer.apple.com/documentation/spritekit/sklabelnode/horizontalalignmentmode Use this property to get or set the horizontal position of the text within an SKLabelNode. The default value is SKLabelHorizontalAlignmentMode.center. ```swift var horizontalAlignmentMode: SKLabelHorizontalAlignmentMode { get set } ``` -------------------------------- ### Get and Set blendMode Property Source: https://developer.apple.com/documentation/spritekit/skeffectnode/blendmode Use this property to get or set the blend mode for drawing the node's contents. The default value is SKBlendMode.alpha. ```swift var blendMode: SKBlendMode { get set } ``` -------------------------------- ### Create and Run a Named Action (Swift) Source: https://developer.apple.com/documentation/spritekit/controlling-actions-precisely-by-using-names Use `run(_:withKey:)` to start an action with a unique identifier. If an action with the same key is already running, it will be replaced. ```swift let moveNodeUp = SKAction.moveBy(x: 0.0, y: 100.0, duration: 1.0) rocketNode.run(moveNodeUp, withKey: "ignition") ``` -------------------------------- ### Get and Set Tile Size in SKTileMapNode Source: https://developer.apple.com/documentation/spritekit/sktilemapnode/tilesize Use this property to get or set the size of each tile in points. This affects the overall dimensions and rendering of the tile map. ```swift var tileSize: CGSize { get set } ``` -------------------------------- ### Initialize SKTileDefinition with Texture and Normal Texture for Lighting Source: https://developer.apple.com/documentation/spritekit/sktiledefinition Create a tile with an additional texture for lighting effects. Specify the size of the tile. ```swift init(texture: SKTexture, normalTexture: SKTexture, size: CGSize) ``` -------------------------------- ### Get adjacencyLowerLeftEdge Mask Source: https://developer.apple.com/documentation/spritekit/sktileadjacencymask/adjacencylowerleftedge Use this static property to get the SKTileAdjacencyMask value representing the lower-left edge. This is useful for defining tile adjacency rules in SpriteKit. ```swift static var adjacencyLowerLeftEdge: SKTileAdjacencyMask { get } ``` -------------------------------- ### init(rectangleOfSize:center:) Source: https://developer.apple.com/documentation/spritekit/skphysicsbody/init%28rectangleofsize%3Acenter%3A%29 Initializes a new physics body with a rectangular shape defined by its size and center point. ```APIDOC ## init(rectangleOfSize:center:) ### Description Initializes a new physics body with a rectangular shape. You can specify the size of the rectangle and its center point. ### Parameters #### Path Parameters - **rectangleOfSize** (CGSize) - The size of the rectangular physics body. - **center** (CGPoint) - The center point of the rectangular physics body. ``` -------------------------------- ### Get and Set lineCap Property Source: https://developer.apple.com/documentation/spritekit/skshapenode/linecap Use this property to get or set the style for rendering the endpoints of a shape node's stroke. The default value is CGLineCap.butt. ```swift var lineCap: CGLineCap { get set } ``` -------------------------------- ### SKVideoNode Initializer Signature Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28avplayer%3A%29-9ydbu This is the signature for the `init(avPlayer:)` initializer. ```swift init(avPlayer player: AVPlayer) ``` -------------------------------- ### SKReferenceNode Initializer: init(fileNamed:) Source: https://developer.apple.com/documentation/spritekit/skreferencenode/init%28filenamed%3A%29-77gs0 Creates a reference node from a file in the app’s main bundle. ```APIDOC ## SKReferenceNode init(fileNamed:) ### Description Creates a reference node from a file in the app’s main bundle. ### Method `convenience init` ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **SKReferenceNode** (object) - A newly initialized reference node. #### Response Example N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **fileName** (String) - Required - The name of a file stored in the app’s main bundle. ### Return Value A newly initialized reference node. ### Discussion This initializer is for loading files that reside inside of the app bundle. ### See Also - `convenience init(url: URL)` - `init(url: URL?)` - `init(fileNamed: String?)` - `init?(coder: NSCoder)` ``` -------------------------------- ### Get and Set Fill Color (iOS) Source: https://developer.apple.com/documentation/spritekit/skshapenode/fillcolor Use this to get or set the fill color for an SKShapeNode on iOS and related platforms. The default fill color is clear. ```swift var fillColor: UIColor { get set } ``` -------------------------------- ### Initialize SKVideoNode with a URL Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28filenamed%3A%29 Initialize a video node using a URL that points to a video file. This can be used for local or remote video files. ```swift init(url: URL) ``` -------------------------------- ### Get and Set lowerAngleLimit for SKPhysicsJointPin Source: https://developer.apple.com/documentation/spritekit/skphysicsjointpin/loweranglelimit Use this property to get or set the smallest angle allowed for the pin joint, measured in radians. The default value is 0.0. ```swift var lowerAngleLimit: CGFloat { get set } ``` -------------------------------- ### SpriteKit Initializer: init(named:fromURL:) Source: https://developer.apple.com/documentation/spritekit/skaction/init%28named%3Afromurl%3A%29 Creates an action of the given name from an action file. Available on iOS 9.0+, iPadOS 9.0+, Mac Catalyst 13.1+, macOS 10.11+, tvOS 9.0+, visionOS 1.0+, and watchOS 2.0+. ```APIDOC ## Initializer: init(named:fromURL:) ### Description Creates an action of the given name from an action file. ### Method Initializer ### Endpoint N/A (Initializer) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **action object** (SKAction) - A new action object. #### Response Example N/A ``` -------------------------------- ### Get and Set Physics Body Velocity Source: https://developer.apple.com/documentation/spritekit/skphysicsbody/velocity Use this property to get or set the velocity vector of a physics body. The velocity is measured in meters per second. ```swift var velocity: CGVector { get set } ``` -------------------------------- ### SKAudioNode Initializers Source: https://developer.apple.com/documentation/spritekit/skaudionode Initializes an SKAudioNode from an existing AVAudioNode, a file name, or a URL. It also includes an initializer for unarchiving. ```APIDOC ## Initializing Audio Nodes ### `init(avAudioNode: AVAudioNode?)` Initializes an audio node from an AVFoundation audio node. ### `convenience init(fileNamed: String)` Initializes an audio node from an audio asset with the specified filename. ### `convenience init(url: URL)` Initializes an audio node from an audio asset with the specified URL. ### `init?(coder: NSCoder)` Tells you when to initialize an audio node that has been unarchived. ``` -------------------------------- ### Get SKNode Frame Source: https://developer.apple.com/documentation/spritekit/sknode/frame Access the `frame` property to get the bounding rectangle of a node's content in its parent's coordinate system. This property is read-only. ```swift var frame: CGRect { get } ``` -------------------------------- ### Get and Set particleAlphaSpeed Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlealphaspeed Use this property to get or set the rate at which a particle's alpha value changes per second. The default value is 0.0. ```swift var particleAlphaSpeed: CGFloat { get set } ``` -------------------------------- ### Initialize Animated SKTileDefinition with Textures and Size Source: https://developer.apple.com/documentation/spritekit/sktiledefinition Create an animated tile by providing an array of textures, the tile size, and the duration each frame is displayed. ```swift init(textures: [SKTexture], size: CGSize, timePerFrame: CGFloat) ``` -------------------------------- ### Get and Set emissionAngle in SpriteKit Source: https://developer.apple.com/documentation/spritekit/skemitternode/emissionangle Use this property to get or set the average initial direction of a particle, expressed as an angle in radians. The default value is 0.0. ```swift var emissionAngle: CGFloat { get set } ``` -------------------------------- ### SKKeyframeSequence Initializer: init(capacity:) Source: https://developer.apple.com/documentation/spritekit/skkeyframesequence/init%28capacity%3A%29 Initializes a new keyframe sequence with a specified initial capacity. ```APIDOC ## init(capacity:) ### Description Initializes a new keyframe sequence. ### Method `convenience init(capacity numItems: Int)` ### Parameters #### Path Parameters * **numItems** (Int) - Required - The initial capacity of the new sequence. ### Response #### Success Response (200) - **SKKeyframeSequence** (object) - A newly initialized empty sequence. ### Discussion This initializer is used to pre-allocate space for keyframes, potentially improving performance if the number of keyframes is known in advance. ### See Also * `init(keyframeValues:times:)` * `init?(coder:)` ``` -------------------------------- ### init(fromURL:) Source: https://developer.apple.com/documentation/spritekit/sktileset/init%28fromurl%3A%29 Initializes an SKTileSet object from a URL. This is a convenience initializer that loads tile set data from the provided URL. ```APIDOC ## init(fromURL:) ### Description Initializes an SKTileSet object from a URL. This convenience initializer loads tile set data from the provided URL. ### Method `convenience init?(fromURL url: URL)` ### Parameters #### Path Parameters - **url** (URL) - The URL from which to load the tile set data. ### Availability iOS 10.0+ | iPadOS 10.0+ | Mac Catalyst 13.1+ | macOS 10.12+ | tvOS 10.0+ | visionOS 1.0+ | watchOS 3.0+ ``` -------------------------------- ### Get and Set Upper Distance Limit for Sliding Joint Source: https://developer.apple.com/documentation/spritekit/skphysicsjointsliding/upperdistancelimit Use this property to get or set the largest distance allowed for the sliding joint. The default value is 0.0. ```swift var upperDistanceLimit: CGFloat { get set } ``` -------------------------------- ### Initialize Node from Archive File Securely Source: https://developer.apple.com/documentation/spritekit/sknode Creates a new node by securely loading an archive file from the game's main bundle, specifying allowed classes. ```swift convenience init(fileNamed: String, securelyWithClasses: Set) throws ``` -------------------------------- ### Get and Set SKPhysicsBody Charge Source: https://developer.apple.com/documentation/spritekit/skphysicsbody/charge Use this property to get or set the electrical charge of the physics body. This value influences electromagnetic force calculations within `SKFieldNode`. ```swift var charge: CGFloat { get set } ``` -------------------------------- ### init(URL:) Source: https://developer.apple.com/documentation/spritekit/skreferencenode/init%28url%3A%29-8glm0 Initializes an SKReferenceNode with a URL. This initializer is available on iOS 9.0+, iPadOS 9.0+, Mac Catalyst 13.1+, macOS 10.11+, tvOS 9.0+, visionOS 1.0+, and watchOS 2.0+. ```APIDOC ## init(URL:) ### Description Initializes an SKReferenceNode with a URL. ### Method Initializer ### Parameters #### Path Parameters - **url** (URL?) - Required - The URL to initialize the SKReferenceNode with. ``` -------------------------------- ### Get and Set Node Position Source: https://developer.apple.com/documentation/spritekit/sknode/position Use this property to get or set the position of a node within its parent's coordinate system. The default value is (0.0, 0.0). ```swift var position: CGPoint { get set } ``` -------------------------------- ### Initialize SKVideoNode with AVPlayer Source: https://developer.apple.com/documentation/spritekit/skvideonode/init%28filenamed%3A%29 Create a video node using an existing AVPlayer object. This provides more control over video playback. ```swift init(avPlayer: AVPlayer) ``` -------------------------------- ### Get and Set particleColorRedSpeed Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlecolorredspeed Use this property to get or set the rate at which the red component of a particle’s color changes per second. The default value is 0.0. ```swift var particleColorRedSpeed: CGFloat { get set } ``` -------------------------------- ### SKAudioNode Initializer with URL Source: https://developer.apple.com/documentation/spritekit/skaudionode/init%28url%3A%29-5bmrl Use this initializer to create an SKAudioNode instance by providing a URL to an audio file. This method is available on iOS, iPadOS, macOS, tvOS, visionOS, and watchOS. ```swift convenience init(URL url: URL) ``` -------------------------------- ### Get and Set particleColorBlueSpeed Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlecolorbluespeed Use this property to get or set the rate at which the blue component of a particle’s color changes per second. The default value is 0.0. ```swift var particleColorBlueSpeed: CGFloat { get set } ``` -------------------------------- ### init(edgeChainFromPath:) Source: https://developer.apple.com/documentation/spritekit/skphysicsbody/init%28edgechainfrompath%3A%29 Creates a physics body shaped by a path. The path is converted into a series of connected line segments forming the edges of the physics body. ```APIDOC ## init(edgeChainFromPath:) ### Description Initializes an SKPhysicsBody with a physics body defined by a path. The path is converted into a series of connected line segments forming the edges of the physics body. ### Method `init` (Initializer) ### Parameters #### Path Parameters - **path** (CGPath) - Required - The path defining the shape of the physics body. ``` -------------------------------- ### Get and Set particleColorAlphaSpeed Source: https://developer.apple.com/documentation/spritekit/skemitternode/particlecoloralphaspeed Use this property to get or set the rate at which the alpha component of a particle’s color changes per second. The default value is 0.0. ```swift var particleColorAlphaSpeed: CGFloat { get set } ```