Coder Social home page Coder Social logo

frameup's People

Contributors

ryanlintott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

frameup's Issues

Right to Left Language Support

Hi,

I have closed my other issue to do with performance and would like your assistance please to let me know if FrameUp is already supporting justifying blocks of text for languages that are right to left.

I usually place the following 2 lines and it works but it didn't with the HFlow Layout.

Text(languageText)
          .multilineTextAlignment(.trailing)
          .frame(maxWidth: .infinity, alignment: .trailing)
    @ViewBuilder
    func justifiedItem(_ item: TextItem) -> some View {
        if let text = viewModel.getText(item) {
            let words = Array(text.string.split(separator: " ").map(String.init).enumerated())
            LazyVStack(spacing: 0) {
                HFlowLayout(alignment: .justified) {
                    ForEach(words, id: \.offset) { word in
                        Text(word.element)
                            .multilineTextAlignment(.trailing)
                            .frame(maxWidth: .infinity, alignment: .trailing)
                    }
                }
            }
        }
    }

I am happy to modify FrameUp myself if you guide me as to what can be done. I am hoping its simple enough to do. Thank you.

Justified Text view with hyphenation

Hi Ryan,

FrameUp is an amazing project. once again thank you for sharing.

I am wondering in additonal to my previous issue regarding right to left language support.

Is it also possible to implement an option for HFlow Layout so that when a word is too long for a row, it would break the word onto 2 lines with the extra characters of the word on the second line?

In my scenario I am displaying like 3 columns of justified text each column has one kind of a language, the frame width for each column is not that wide so sometimes the word is too long in its row and to display it correctly I would like to break it up on to 2 lines.

Hoping for a response whenever you are free on the 2 issues please. I pormise I won't have any more :].

Thank you.

Wael

Great project. Text Justification SwiftUI issue.

Hi Ryan :),

A few days ago I was excited when I find out about FrameUp, its exactly what I was looking for, however because of a specific SwiftUI bug with LazyVStack and a ScrollView it has prevented me from properly using FrameUp because of performance issues (not directly related to FrameUp).

I am hoping you will have some time to take a look please at my question on stackoverflow and see if you can help me with the appropriate solution for implementing simple Text justification for 100's of text blocks that are loaded dynamically.

I think implementing the text justification manually as described in my question on stackoverflow is the best approach from a performance perspective espcially when I need to have 100's of small Text views to be loading text dynamically. You'll understand what I mean when you have read my question here as to why I came to that conclusion -

https://stackoverflow.com/questions/76503942/swiftui-justify-text-by-words-without-using-uitextview-and-not-change-kerning

Thank you,

Wael

Justified Attributed String

Hi Ryan :)

Thank you for all of your respones. This is my last challange that I am currently working on. I am a bit confused about how to solve.

The getText function returns an AttributedString. In the sentense I am passing it has some couple of words that are in a different language so its using its own font with a different color. In a normal SwiftUI Text view my AttributedString appears correctly.

I understand why the attributes get lost as I am converting the attributed string back to a string to extract the words but how can I maintain the attributes for every word? Thanks.

I think its probablly this line it needs to return an AttributedString !

let words = Array(text.string.split(separator: " ").map(String.init).enumerated())

extension AttributedString {
    var string: String {
        String(self.characters)
    }
}
    @ViewBuilder
    func justifiedItem(_ item: TextItem, _ language: LanguageType) -> some View {
        if let text = viewModel.getText(item, language) {
            let words = Array(text.string.split(separator: " ").map(String.init).enumerated())
                HFlowLayout(alignment: .justified) {
                    ForEach(words, id: \.offset) { word in
                        Text(word.element)
                            .foregroundColor(viewModel.color(item))
                            .font(Font(viewModel.font(item, language)))
                    }
                }
        }
    }

macOS Support

Looks like some of this should work on max but readme says iOS only

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.