ViewModifier
extension ViewModifier
-
A public global function that formats and prints a message to the console corresponding to data stored as JSON for a given print number and behaves as an analogue overload of the Swift
print(_:separator:terminator:)
function.This function behaves exactly as the
Clarity
global scope print overload with the same parameters other than to return an emptyView
that allows it to be used within aViewModifier
. Because it will always be called within aViewModifier
it is still possible to call it without having to specify a defining type – in the same manner as the Swiftprint(_:separator:terminator:)
function.Declaration
Swift
public func print(_ printNumber: Int, functionName: String? = nil, settings: SettingsManagerService? = nil) -> some View
Parameters
printNumber
An Int that acts as a unique number used as a key to access a specific associated message from a dictionary containing all message data.
functionName
An optional parameter for a
#function
macro argument. If this parameter is includedClarity
formats and prints the log as a function call node for the function that containsprintNumber
.settings
An optional parameter for a dynamic
SettingsManagerService
instance. TheSettingsManagerService
instance can have its properties set programmatically to a variety of values. This enables more convenient and dynamic evaluation of a wider range of unit tests in a test target than is possible when using the JSON access mechanism.Return Value
An empty
View
that allows the function to conform to theViewModifier
protocol and be used within aViewModifier
as well as within thebody
var of aView
instance. -
A public global function that formats and prints a message to the console corresponding to data stored as JSON for a given print number and behaves as an analogue overload of the Swift
print(_:separator:terminator:)
function.This function behaves exactly as the
Clarity
global scope print overload with the same parameters other than to return an emptyView
that allows it to be used within aViewModifier
. Because it will always be called within aViewModifier
it is still possible to call it without having to specify a defining type – in the same manner as the Swiftprint(_:separator:terminator:)
function.Declaration
Swift
public func print(_ printNumber: Int, values: Any? = nil, settings: SettingsManagerService? = nil) -> some View
Parameters
printNumber
An Int that acts as a unique number used as a key to access a specific associated message from a dictionary containing all message data.
values
An optional parameter for the inclusion of variable values to be printed as part of the message. If this parameter is included
Clarity
formats and prints the log as a value report node. The parameter can be a single value of any type, aCollection
of any type or an instance conforming to theError
protocol.settings
An optional parameter for a dynamic
SettingsManagerService
instance. TheSettingsManagerService
instance can have its properties set programmatically to a variety of values. This enables more convenient and dynamic evaluation of a wider range of unit tests in a test target than is possible when using the JSON access mechanism.Return Value
An empty
View
that allows the function to conform to theViewModifier
protocol and be used within aViewModifier
as well as within thebody
var of aView
instance.