This repository was archived by the owner on Oct 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
This repository was archived by the owner on Oct 13, 2018. It is now read-only.
Missing Product Recipe #27
Copy link
Copy link
Open
Description
Howdy!
I've been working on some recipes for the Product and Descriptive Alert templates. Once completed, did you want me to submit a PR?
I'm also not sure of the best approach in handling actions. Is there a way for a recipe to intercept these or is it one global handler for the application? Currently I'm using the following:
func actionIDHandler(id: String) {
switch id {
case "showDescription":
DescriptionRecipe.show(selectedMovie)
break
default:
break
}
}My approach in generating the XML is slightly different to yours too and I'd appreciate your opinion on whether this is a good idea or not. I have an XML file called product.xml that has placeholders such as {{TITLE}} and {{DESCRIPTION}}. These are then replaced to generate the final template with the following:
public var template: String {
var xml = ""
if let url = NSBundle.mainBundle().URLForResource("product", withExtension: "xml") {
xml = try! String(contentsOfURL: url)
xml = xml.stringByReplacingOccurrencesOfString("{{DIRECTOR}}", withString: director)
xml = xml.stringByReplacingOccurrencesOfString("{{TITLE}}", withString: title)
xml = xml.stringByReplacingOccurrencesOfString("{{ACTORS}}", withString: actorString)
xml = xml.stringByReplacingOccurrencesOfString("{{DESCRIPTION}}", withString: description)
xml = xml.stringByReplacingOccurrencesOfString("{{IMAGE}}", withString: image)
xml = xml.stringByReplacingOccurrencesOfString("{{YEAR}}", withString: year)
}
return xml
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

