Documentation Language: Swift

Method

scanFile(_:)

Scans a file for protected areas and extracts their content.

func scanFile(_ path: String) throws

Parameters

path

The file path to scan

Discussion

This method reads the specified file and searches for protected area markers. For each protected area found, it extracts the content between the markers and stores it for later retrieval.

Protected area markers have the format:

{prefix}START PROTECTED REGION {id}
{content}
{prefix}END PROTECTED REGION {id}

Example

// Scan existing file
try await manager.scanFile("/output/Person.swift")

// Now can retrieve preserved content
let imports = await manager.getContent("user-imports")