New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LayoutLoading with support for loading node from Data #90
Comments
I'd like to have a more concrete idea of the use cases for this before adding the new API, as each additional method introduces more maintenance burden if I need to deprecate stuff or add new parameters later. Storing XML templates in Core Data doesn't seem like a very common use case, and probably isn't optimal if you're trying to implement a cache, and as you say there is already a way to create a LayoutNode from XML in the rare cases that you might need to. |
I guess you're right. If you want more advanced options you should use the LayoutNode API instead of LayoutViewController. I just think Do you think the remote vs. local resource issues where param is required only for remote resources is still a valid bug or is it an expected behaviour? |
The |
This is my guess FWIW :) The file referenced by the
The param is required, but I think that the When referencing a remote resource the body of the Does it make sense? |
@mariob yes, I believe that's the reason. I should probably introduce some concept of "file scope" to make this behavior more consistent. |
Agree. I'll close the issue. If you need it as reminder feel free to reopen it again :) |
Actually, I have a use case for this: I'm evaluating Layout for use in a new iOS app which will show a dynamic user interface, which will be communicated by another computer in the local network. |
It was less difficult than I thought ;-) |
Hi,
What do you think about adding support for loading xml data from a
Data
instance in theLayoutLoading
extension?. Currently there's only support for loading from a local file or URL.Suggested function signature (which pretty much mirrors the LayoutNode's init):
This could be used, amongst other things, to load xml blobs from CoreData or having xml data as strings in the code.
I know that it's already possible to do this if you create the
LayoutNode
yourself using theinit(xmlData: Data)
initialiser and set it as thelayoutNode
instance on theLayoutViewController
.However, I think it would be convenient to have the option available in the
LayoutLoading
extension and use it insideviewDidLoad
. I guess the API found inLayoutViewController
is what most developer will use to setup the view, right?Could probably do a PR for this if it's of any interest?
Some neat this that could be done is showing a spinner while loading content from a remote server.
Actually, I think I found an issue while trying this out. If I point to a remote resource, the loading fails with an "unknown property 'text'" error. If I point to the same file locally, it works.
Adding
<param name="text" type="String"/>
to the body fixes the issue but I don't think it's the correct behaviour, right? Should I file another issue for this?As a side note... In a post 1.0 world, I think it would be cool to support custom url protocol providers. A protocol provider would be responsible for fetching and providing xml data based on the protocol in the url. For example, I could register a protocol provider, myresources://. When the layout engine finds any xml resources to load with that protocol, it hands over the loading to the provider. A typical provider could be one that fetches a signed resources and before it's handed over to the Layout engine the signature is verified :)
The text was updated successfully, but these errors were encountered: