Code Monkey home page Code Monkey logo

Comments (14)

incanus avatar incanus commented on May 23, 2024 2

Just FYI I will still get to this, but my needs for a project changed and I'm not actively blocked by this anymore so it'll be a little later on. That said this is the best-looking GUI-based Markdown renderer I've seen and I'd like to help tune it up for possible future use!

from notepad.

incanus avatar incanus commented on May 23, 2024 1

This was a red herring, since CocoaPods provides an umbrella header file and creates all pods as frameworks.

The real problem is that per http://stackoverflow.com/a/37089794/977220 the Notepad class isn't public by default outside of the framework. Again, it works in your example since the Notepad.swift file is present in the same module as the app.

I'll submit a PR for this. It gets complicated when you try to use a Notepad in IB, since you can't later set the themeFile in code. Making Storage also public is one fix, but that requires a bunch of other stuff be made public as well.

One idea I have here is to introduce a safe setter for themeFile on Notepad so we don't have to expose Storage, but that introduces concurrency issues with setting the themeFile on a Notepad after it's already been rendered once.

¯\_(ツ)_/¯ coding

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

Hey, thanks for the note! Can you link me to an example of a framework header, and I can create one? Or, alternatively you could open up a pull request?

from notepad.

incanus avatar incanus commented on May 23, 2024

Sure, it should just be as simple as something like this:

https://github.com/mapbox/MapboxGeocoder.swift/blob/master/MapboxGeocoder/MapboxGeocoder.h

In this project's case, maybe:

#import <UIKit/UIKit.h>

FOUNDATION_EXPORT double NotepadVersionNumber;

FOUNDATION_EXPORT const unsigned char NotepadVersionString[];

All of the Swift files should be included automatically since they are part of the module.

I'm not 100% positive this will solve the problem, but I think it should. I will try to experiment more.

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

Great, thanks! Let me know what you find, and happy to merge anything in — it doesn't hurt to have a framework header regardless!

from notepad.

incanus avatar incanus commented on May 23, 2024

Another issue here is that Theme refers to Bundle.main.path to find its JSON resources, yet the main bundle is actually the user's app, not the Notepad.framework. I have a fix for this as well.

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

Awesome, thanks. Yeah — I definitely am going to implement something with IBInspectables/IBDesignables going forward, but feel free to hack away! Looking to build this out so it's extra flexible (roadmap may include loading themes from online, who knows what the future holds).

Regarding exposing Storage, I agree with you. I found it difficult to work with NSTextStorage and the safety of Swift, in terms of the order of initialization in classes. I used a different approach in RFMarkdownTextView that I could get away with as it was Objective-C.

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

Also, debating between themeFile and theme as the variable. Thoughts?

from notepad.

incanus avatar incanus commented on May 23, 2024

theme implies a Theme will be passed, which you might also prefer to keep private. themeFile, themeName, or themePath implies a String (in the latter case, allowing you to pass your own full JSON path).

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

I agree - just checking because I hate camel case ¯\_(ツ)_/¯.

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

@incanus do you have the header for CocoaPods in git already? Because if not I have some time on my hands now and can clean some stuff up. Just let me know!

from notepad.

incanus avatar incanus commented on May 23, 2024

The header isn’t necessary—CocoaPods makes one for you when it packages your project as a dynamic framework.

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

Ah - so just adding public should work. Great, I'll do that now!

from notepad.

ruddfawcett avatar ruddfawcett commented on May 23, 2024

Fixed by 6a9e702.

from notepad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.