Complete the code to define a Swift module named "Utilities".
public struct [1] { public static func greet() -> String { return "Hello from Utilities!" } }
The module name should be Utilities to match the struct name and purpose.
Complete the code to import the module named "Networking" in a Swift file.
import [1]
To use code from the Networking module, you must import it explicitly.
Fix the error in the code by completing the access control keyword to expose the function outside the module.
struct Helper {
[1] func performTask() {
print("Task performed")
}
}The public keyword makes the function accessible outside the module.
Fill both blanks to define a protocol and make a class conform to it in Swift.
protocol [1] { func execute() } class Task: [2] { func execute() { print("Executing task") } }
The protocol is named Runnable, and the class Task conforms to it by listing Runnable after the colon.
Fill all three blanks to create a Swift package with a public struct and a public method.
public struct [1] { public func [2]() -> String { return "[3]" } }
The struct is named Logger, the method logMessage, and it returns the string Logging successful.