How To Create a Standalone Swift SDK - ios

I would like to create a SDK to use without iOS or Xcode.
Let me explain. I would like to use Swift language to create a framework with which to develop front-end. In few words with this framework I would like create html pages for web and substitute HTML, CSS and javascript with swift. The idea get from what Apple does with iOS. If you look how is made a xib or storyboard you can see xml file. I would like to do the same thing or take the idea and applicate for the web.
To do this I need to create an SDK that is not connected to iOS but that I can use in any IDE like VSCode or similar or also in a my own IDE created by me.
An other thing that could help you to understand what I mean is Javascript. In javascript there is a command createElement that let you to create an element, adding class, attribute and, yes, style. But create UI in this way, you understand well that is very hard. So, I Would like create a framework in iOS style, to create frontend in simpler and easier way.
I would like create create this framework (if it's possible) in Xcode and I don't want have any interference by iOS.
So, have you any suggests about how to start?
thank you

XIB layout is constraint-based, which means you describe your view hierarchy and constraints, and autolayout system does the layout for you every time according to constraints you've provided. Technically, inside it converts constraints to a system of linear equations and solves it in run-time, thus calculating frames for every UIView. And .xib file is just an XML with all the views, their properties and constraints. (that's a bit simplified, but you've got the idea)
HTML layout is totally different: HTML is a declarative way to describe elements on a page, i.e you describe every element with tags, and every tag (or its parent, or CSS file) already contains all necessary information about its positioning and appearance, so browser just parses and renders a page accordingly.
Theoretically, you could've reinvented a web browser: write your HTML parser, then write UI to somehow render it, and add feature to alter HTML tags by moving the page elements with mouse. But that would've taken a lot of time and effort :)
There are many website constructors on WWW, which allow you to build simple sites only with drag-and-drop (no coding needed). Also, you can inspect element in your browser, and then change some attributes of some element right in the debug window, and see changes in realtime.
P.S Im not a web/frontend developer, but I suppose that IDE's popular among frontenders already have some features or plugins that allow them to render HTML/CSS code and see changes in realtime, just like browser's debug menu.

Related

tx_news - Insert a slide show in detail mode

I would like to display a slideshow in detail mode, if the news features several pictures.
For example, previously I used tt_news, and its rgsmoothgallery extension met this need.
Do you know a simple solution for tx_news?
My system: Typo3 7.6.18 - tx_news 6.0.0
you need to build the appropiate HTML markup in your templates.
Slideshows, lightboxes, accordions, tabs, ... need a special markup so the initializing javascript can identify all parts and rebuild the DOM. As it is about which JS-lib you use you need to know which tags are expected, which data is expected. Look in the documentation of the JS-lib.
In general you have the include of the JS-lib,
then you build your HTML,
somewhere you call something like onLoad("initSlideshow('.slideshow', options)" so that the JS can modify your DOM in all the (div?) tags which have a class 'slideshow'. Often options could be given in parameters or in data-attributes.
The rebuild of the DOM includes adding eventhandler so you can interact with the content.
As there are multiple libs and also multiple content it is easier to do this individually per installation than to build an extension which adds just one JS lib to very special content. If an extension would modify the templates of news, you can't replace the news templates easily (or you need to build the complete template where you won't need the extension at all.
To edit the detail page you need to edit the Resources/Private/Templates/News/Show.html
Here you can include your slider.
To load the JavaScript file from this template you could use the vhs viewhelper v:asset.script

Explanation of (undocumented?) XUL dialog attribute buttoniconaccept (and similar)

I am pulling this attribute directly from Mozilla Firefox's about.xul file which shows the About dialog box for an add-on. It is a relatively simple XUL dialog with no inputs, locale data pulled from DTD entities, string bundle properties and JavaScript.
<!-- omni.ja!/chrome/toolkit/content/mozapps/extensions/about.xul -->
<!-- chrome://mozapps/content/extensions/about.xul -->
<dialog id="genericAbout"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="init();"
buttons="accept"
buttoniconaccept="close"
onaccept="close();">
MDN: Dialogs and Prompts and MDN: dialog both mention something about attributes that are formed by concatenating (pseudo-regexp):
"button" + "(label|accesskey|oncommand)" + "(accept|cancel|disclosure|help|extra[12])"
For example: buttonlabelaccept.
However, I could not find any documentation about the use of icon. The word icon does not even show up on either of the above-mentioned pages! What does it do? What is the correct way to use it?
I'm trying to make my add-on about page more modular, without loading internal files from omni.ja(r), which pulls in a LOT of unnecessary code with it. I am developing a very streamlined version, that will style itself appropriately depending on calling context.
I want it to look like Firefox's official About < addon.name > dialog if called from about:addons context-menu, or from my add-on's status-bar context-menu. I want a slightly different appearance if viewed from within the Options dialog as an iframe inside a XUL. I already have that structure set up. Just tweaking the little quirks.
This is not critical design or feature wise, and indeed the entire API will go away in a few months, but it just bothers me to not really understand this, so I want to figure it out before I let it go an move on to more important things. But I will if I absolutely can't find an answer. But it's one of those stupid little things that will just bother me a disproportionate amount. =D
If you can point me to documentation I may have missed, or even specific Mozilla source code, and a few examples, or a more complete explanation and typical use-cases, that would be great.
If you check the "blame" for about.xul, you'll see that the line was added to fix bug 422763. Judging from the screenshot in the bug, GNOME (Linux) has (had?) a convention of putting icons on dialog buttons, and this attribute allows overriding the default icon (inferred from the button type).
If you search for buttonicon, you'll find the code that handles this attribute in toolkit/content/widgets/dialog.xml.

How To Get table of content in Vfr Reader for Pdf in iphone sdk?

I am using VFR reader to display my pdf's. I need to extract the Table of Contents on a button click and display it in a tableview then it should lead to the respective pages while tapping on each.
Parsing the PDF Table of Contents is actually not extremely hard. You can use a tool like Apple's PDF "Voyeur" to see the structure or something like Adobe Acrobat's Preflight Browser:
You see that the "Outline" is a fairly simple tree that can be parsed using the various CGPDF* functions. The challenge here is to also parse the destination/action type. PDF doesn't make things too easy and doesn't give you a page number, instead usually you will find a linked named destination. This can be resolved by cross-referencing another table, it's best to look this up in the PDF spec. This is of course just one of the options, it can also be that the destination is one of the > 10 action types that rage from GoTo over named actions (e.g. Next Page) to JavaScript (e.g. this.pageNum = x). In the image above you see a classical GoTo action with the longer string being the named reference.
There are also some other special cases, notably for older latex documents and some pages from the PDF 1.1 spec that did things a bit differently, so be careful about implementing all corner-cases of the PDF spec to not get surprises later on.
Outlines sometimes also include URI actions, so at least implement that type as well. And they can also have font styles and color, so you won't ever get bored. Been there, done that in our commercial PSPDFKit PDF SDK for iOS and Android.

textarea that was using plain text with option of markdown or textile filter now needs images

My clients can enter text into textarea and have the option to use the markdown or textile filters for each textarea.
With some models (articles, newsletter, etc) they can upload images to associate with the model, which are displayed in a column next to the text of the text.
This worked fine for a while, but they have now told me that the want the ability to put the images INSIDE the text a specific positions.
What is the best way to go about this? I suppose I may have to use a wysiwyg for this, but would rather not. And how would this work for images which are not yet on the server, etc?
There are different directions you could go to:
Follow the path of Confluence, which released in their new version 4.0 a rewritten WYSIWYG editor, that stores as source XHTML, not any more wiki markup.
Leads to an update of all pages when migrating.
Was pretty difficult to implement. I do not know if they use any more the TinyMCE editor of previous versions.
Follow the format of markdown how to include images in your source format. So by typing: This is my text. !image.png! The inline image shows ..., you will have a format that is understandable.
You have to expand the interpretation, so that the !<filename>! will be mapped that is stored locally anyway.
You have to add clear-up dialogs for the images that are yet not known, so doing bulk uploads ...
You may provide a drag area on your view, that then shows the filename and gives examples how to include that inside the text area.
Go for something in between, by allowing users to drag images inside the editor. There are plugins written in Javascript that allow you to do that, e.g. UI Draggable for jquery
I have no idea how to integrate that image inside the text editor. Overlay?
So the second one is the easiest, and the user knows how to do it. If they only decide that this is the solution they want to have :-)
I think I'm going to use a combination of #2 above, and the Liquid templating engine.

Easy way to find a view file in rails?

I develop rails applications with my designer who has minimum knowledge about rails.
She works on Windows through file-sharing from a Linux server.
She always has hard time finding view files to work on.
I usually use 'grep' to find a view file.
But she can't.
If you have a good suggestion, please share with me.
I have an idea which may be overkill.
Is there a way to automatically add comments around view files (including layouts and partials?) in html file?
Like this:
<!--Starting app/views/some_dir/some_file.html.erb-->
HTML here...
<!--Ending app/views/some_dir/some_file.html.erb-->
This way, my designer can find the file very easily.
Of course, this should be automatic and development environment only.
Thanks.
Sam
I use the Rails Footnotes gem (https://github.com/josevalim/rails-footnotes) in some of my projects which allows me to click a link in the footer of my app that opens the current view (also shows partials) in TextMate. Not sure if it could be customised to work with a Windows text editor but you could look at the URL to work out the file name.
I.e to open a file in MacVim, it creates the following link:
mvim://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml
and for TextMate:
txmt://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml

Resources