<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>BTW:</p>
    <p>from the marketing perspective (where I came from) I love the
      name you gave your babe:</p>
    <p>I would also love to have two apps, for Android the existing
      "Viewer" what it isn't anymore with the new possibilities for
      editing e.g. and for iOS your awesome work, both as
      "LibreOfficeLight".<br>
    </p>
    <p>Given they have mainly the same functionalities and maybe have
      some less or more differences here and there. <br>
    </p>
    <br>
    <div class="moz-cite-prefix">Am 29.12.2017 um 16:43 schrieb jan
      iversen:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAK2iWdTP57NtP24sNKHdYyO8hVfK-YNOutS6Tqt_xr=wCuPQyg@mail.gmail.com">
      <div dir="ltr">Please do not misunderstand my comments, I am open
        to any enhancements especially on the linking process of the
        app...but I would like to see a benefit of the changes.
        <div><br>
        </div>
        <div>rgds</div>
        <div>jan I.</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 29 December 2017 at 09:36, Jon
          Nermut <span dir="ltr"><<a
              href="mailto:jon.nermut@gmail.com" target="_blank"
              moz-do-not-send="true">jon.nermut@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Thanks for the reply Jan.
              <div><br>
              </div>
              <div>My main point about BridgeLOKit was that you don't
                really need to add another FFI on top of the existing
                LibreOfficeKit.h FFI.</div>
              <div>Swift can import and use the existing _LibreOfficeKit
                / _LibreOfficeKitClass and _LibreOfficeKitDocument /
                _LibreOfficeKitDocumentClass structs and their functions
                just fine. Swift actually has excellent C integration
                (and non-existent C++). To do so I just added:</div>
              <div><br>
              </div>
              <div>
                <p class="m_7086953373973236056gmail-p1"
style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(210,143,90);background-color:rgb(40,43,53)">#define
                  LOK_USE_UNSTABLE_API <span
                    class="m_7086953373973236056gmail-s1"
                    style="color:rgb(139,132,207)">1</span></p>
                <p class="m_7086953373973236056gmail-p2"
style="margin:0px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(228,67,71);background-color:rgb(40,43,53)"><span
                    class="m_7086953373973236056gmail-s2"
                    style="color:rgb(210,143,90)">#import </span>"../../../include/<wbr>LibreOfficeKit/LibreOfficeKit.<wbr>h"</p>
              </div>
              <div><br>
              </div>
              <div>Into lokit-Bridging-Header.h, and the struct types
                mentioned above are usable directly within Swift without
                anymore C needed - LibreOfficeKitWrapper.swift is an
                example of using the functions from these structs
                directly, and wrapping the C struct pointers in swift
                classes, making them encapsulated and easier to use. </div>
              <div>The exception being the lok_init functions, which
                need to be included and called from within a C file.</div>
              <span class="">
                <div><br>
                </div>
                <div>>> The LIBRARY_SEARCH_PATH should be
                  overwritten by the xcconfig file, but I will need to
                  check that.</div>
                <div><br>
                </div>
              </span>
              <div>Oh, I couldn't find it... where is it supposed to be
                generated to? I changed the the path settings in
                LibreOfficeLight.xcodeproj like this:</div>
              <div><br>
              </div>
              <div>
                <div>-<span style="white-space:pre-wrap">                         </span>LIBRARY_SEARCH_PATHS
                  = /Users/jani/LO/core/ios/<wbr>generated/;</div>
                <div>+<span style="white-space:pre-wrap">                         </span>LIBRARY_SEARCH_PATHS
                  = $PROJECT_DIR/../generated/;</div>
              </div>
              <div><br>
              </div>
              <div>I tried a few settings on the linking, couldn't make
                it better. Need to find a way to work out what its
                doing... I'll have more of a play.</div>
              <div>My suggestion is to split the C integration, and it's
                swift wrappers, into a separate Framework project, and
                let that produce a dylib.</div>
              <div>That should link pretty much instantly to the app,
                and should only rebuild and link when the libreoffice
                lib changes, or the code in the Framework</div>
              <div class="gmail_extra"><br>
              </div>
              <div class="gmail_extra">Cheers</div>
              <span class="HOEnZb"><font color="#888888">
                  <div class="gmail_extra"><br>
                  </div>
                  <div class="gmail_extra">Jon</div>
                </font></span>
              <div>
                <div class="h5">
                  <div class="gmail_extra"><br>
                  </div>
                  <div class="gmail_extra"><br>
                    <div class="gmail_quote">On Fri, Dec 29, 2017 at
                      6:38 PM, jan iversen <span dir="ltr"><<a
                          href="mailto:jani@apache.org" target="_blank"
                          moz-do-not-send="true">jani@apache.org</a>></span>
                      wrote:<br>
                      <blockquote class="gmail_quote" style="margin:0px
                        0px 0px 0.8ex;border-left:1px solid
                        rgb(204,204,204);padding-left:1ex">
                        <div>
                          <div dir="auto">Hi</div>
                          <div dir="auto"><br>
                          </div>
                          <div dir="auto">adding dev list to reply, so
                            that others might benefit from the info.</div>
                          <div dir="auto"><br>
                          </div>
                          <div class="gmail_quote"><span
                              class="m_7086953373973236056gmail-">
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div>Hope you don't mind the
                                    unsolicited email, I figured you
                                    were the guy to talk to about this
                                    from the git commits.</div>
                                </div>
                              </blockquote>
                            </span>
                            <div dir="auto">I am working actively on
                              creating a version of LO for the iPad.</div>
                            <span class="m_7086953373973236056gmail-">
                              <div dir="auto"><br>
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div>So I got it compiling via lode,
                                    with just a couple of hitches (had
                                    to install libassuan, had to make
                                    sure to use the make out of lode,
                                    and there is a hard coded
                                    LIBRARY_SEARCH_PATH to
                                    /Users/jani/... in the ios project
                                    file)</div>
                                </div>
                              </blockquote>
                            </span>
                            <div dir="auto">I do not understand why you
                              had to install extra libraries. I work on
                              high sierra with xcode 9 and have not
                              installed that library.</div>
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">The LIBRARY_SEARCH_PATH
                              should be overwritten by the xcconfig
                              file, but I will need to check that.</div>
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">There are 2 projects, but I
                              assume you talk about the kit project?</div>
                            <span class="m_7086953373973236056gmail-">
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div><br>
                                  </div>
                                  <div>1. The app doesnt actually
                                    attempt to render yet? Were you
                                    planning on using CATiledLayer for
                                    that? I've used it a couple of times
                                    (for PDFs)... it's fun</div>
                                </div>
                              </blockquote>
                              <div dir="auto"><br>
                              </div>
                            </span>
                            <div dir="auto">No it doesn’t. As you
                              probably have seen the render function is
                              near empty, I am strugling to find out
                              what the tiled calls returns and how to
                              use that in the swift app.</div>
                            <span class="m_7086953373973236056gmail-">
                              <div dir="auto"><br>
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div>2. The static lib, and the
                                    compiled app, are pretty fat. (At
                                    least in debug for the simulator -
                                    ~400mb, I havent tried the release
                                    build yet). Too fat to embed in my
                                    app, it would have to be a separate
                                    app. Any insight as to whether this
                                    could ever be cut down to a
                                    reasonable size?</div>
                                </div>
                              </blockquote>
                            </span>
                            <div dir="auto">Well is it actually quite
                              reduced. LO is simply big.</div>
                            <span class="m_7086953373973236056gmail-">
                              <div dir="auto"><br>
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div>3. The link time on the app is
                                    outrageously slow at the moment - at
                                    least on my macbook pro - I guess
                                    this is related to the size and
                                    number of symbols in the static lib.
                                    That's what the dummy.c file is all
                                    about? Needs to be quarantined from
                                    the app somehow.  Perhaps by keeping
                                    it in a Framework project? Or
                                    cutting down its size. I was too
                                    scared to turn on LTO...</div>
                                </div>
                              </blockquote>
                            </span>
                            <div dir="auto">The link time is my biggest
                              problem, linking the kit is a fraction of
                              linking the app, and It seems to be the
                              swift interface that is the problem.</div>
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">dummy.c is to link without
                              the kit, and it is automatically
                              quarantined, look in build phases, where
                              you will see it is not being compiled.</div>
                            <span class="m_7086953373973236056gmail-">
                              <div dir="auto"><br>
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div>4. Just wondering the reasoning
                                    for starting a new C interface into
                                    LibreOfficeKit (eg <span
style="background-color:rgb(40,43,53);color:rgb(147,201,106);font-family:Menlo;font-size:11px">BridgeLOkit_*</span> )?</div>
                                </div>
                              </blockquote>
                            </span>
                            <div dir="auto">How else would you make a
                              C/C++ interface for swift ?</div>
                            <span class="m_7086953373973236056gmail-">
                              <div dir="auto"><br>
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div>I had success in talking to the
                                    main LibreOfficeKit.h file directly
                                    from swift by including it in the
                                    bridging file. Using it directly
                                    would take away a lot of duplication
                                    needed to flesh out BridgeLOkit.
                                    Granted the main C api isnt that
                                    friendly to use, but IMHO it would
                                    be better to do the wrapping and
                                    making the API friendly on the Swift
                                    side, rather than another layer of
                                    C, which then still needs swift
                                    friendly classes around it. </div>
                                  <div>The main problem is with the way
                                    LibreOfficeKitInit works (which
                                    seems weird...), for which I reused <span
style="background-color:rgb(40,43,53);color:rgb(147,201,106);font-family:Menlo;font-size:11px">BridgeLOkit_Init</span> and
                                    added a func to get the pointer to
                                    kit out.</div>
                                  <div>See the attached
                                    LibreOfficeKitWrapper.swift file -
                                    it has just a couple wrapped
                                    functions done but you can see what
                                    I mean. Needs the rest filled in and
                                    memory handling done.</div>
                                </div>
                              </blockquote>
                            </span>
                            <div dir="auto">Functions not declared in
                              the bridge are unlikely to work in swift
                              (according to the swift documentation).</div>
                            <span class="m_7086953373973236056gmail-">
                              <div dir="auto"><br>
                              </div>
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div><br>
                                  </div>
                                  <div>I've done this before for Pdfium
                                    - which also has a C based FFI. We
                                    created a framework called
                                    PdfiumSwift which had swift classes
                                    like PDFDocument, PDFPage etc which
                                    wrapped the C interface and made
                                    consuming it easy in Swift. We
                                    hooked the memory management off the
                                    swift deinit() etc.  It used an
                                    internal private module to consume
                                    the C API so it was just the Swift
                                    API exposed outside of the framework
                                    / module.</div>
                                </div>
                              </blockquote>
                            </span>
                            <div dir="auto">this is basically the same
                              the kit project does, except it does not
                              use classes.</div>
                            <div dir="auto"><br>
                            </div>
                            <div dir="auto">rgds</div>
                            <div dir="auto">jan i</div>
                            <span class="m_7086953373973236056gmail-">
                              <blockquote class="gmail_quote"
                                style="margin:0px 0px 0px
                                0.8ex;border-left:1px solid
                                rgb(204,204,204);padding-left:1ex">
                                <div>
                                  <div><br>
                                  </div>
                                  <div>Once the basic wrapping is done,
                                    then these classes provide a good
                                    place to add stuff like converting
                                    the raw tiles into iOS friendly
                                    bitmaps etc.</div>
                                  <div><br>
                                  </div>
                                  <div>Anyway, good job on getting it
                                    this far, and happy new year.</div>
                                  <div><br>
                                  </div>
                                  <div>Cheers</div>
                                </div>
                                <div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                  <div>Jon Nermut</div>
                                </div>
                              </blockquote>
                            </span></div>
                        </div>
                        <span class="m_7086953373973236056gmail-HOEnZb"><font
                            color="#888888">
                            <div dir="ltr">-- <br>
                            </div>
                            <div
                              class="m_7086953373973236056gmail-m_-3031170130536485458gmail_signature">Sent
                              from My iPad, sorry for any misspellings.</div>
                          </font></span></blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LibreOffice mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LibreOffice@lists.freedesktop.org">LibreOffice@lists.freedesktop.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/libreoffice">https://lists.freedesktop.org/mailman/listinfo/libreoffice</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Regards / Mit freundlichen Grüßen

Sophia Schröder
--- 
German Language Team
LibreOffice.org
IRC: SophiaS</pre>
  </body>
</html>