Returns the range of the specified component in the bytes of a URL.


func CFURLGetByteRangeForComponent(_ url: CFURL!, _ component: CFURLComponentType, _ rangeIncludingSeparators: UnsafeMutablePointer<CFRange>!) -> CFRange



The URL containing component.


The type of component in anURL whose range you want to obtain. See CFURLComponentType for possible values.


Specifies the range of component including the sequences that separate component from the previous and next components. If there is no previous or next components, this function will match the range of the component itself. If anURL does not contain component, rangeIncludingSeparators is set to the location where the component would be inserted.

Return Value

The range of bytes for component in the buffer returned by the CFURLGetBytes(_:_:_:) function. If anURL does not contain component, the first part of the returned range is set to kCFNotFound.


This function is intended to be used in conjunction with the CFURLGetBytes(_:_:_:) function, since the range returned is only applicable to the bytes returned by CFURLGetBytes(_:_:_:).

See Also

Getting URL Properties


Returns the base URL of a given URL if it exists.

func CFURLGetBytes(CFURL!, UnsafeMutablePointer<UInt8>!, CFIndex) -> CFIndex

Returns by reference the byte representation of a URL object.

func CFURLGetTypeID() -> CFTypeID

Returns the type identifier for the CFURL opaque type.

func CFURLResourceIsReachable(CFURL!, UnsafeMutablePointer<Unmanaged<CFError>?>!) -> Bool

Returns whether the resource pointed to by a file URL can be reached.