Swiftpack.co - MaheshRathod4/MRAttributedTextView as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MaheshRathod4.
MaheshRathod4/MRAttributedTextView 0.0.1
MRAttributedTextView is made with UiKit.It allows you to change the font and color of substrings and also handle substring click events.
⭐️ 7
🕓 2 years ago
iOS
.package(url: "https://github.com/MaheshRathod4/MRAttributedTextView.git", from: "0.0.1")

Overview

MRAttributedTextView is made with UiKit.It allows you to change the font and color of substrings and also handle substring click events.

Usage/Example - 1

 GeometryReader { proxy in 
    MRAttributedTextView(text: "We'will send you an One Time Password on this +918141691419",
                      subStrings: ["One Time Password","+918141691419"], 
                      width: proxy, 
                      onTapItemString: { value in
                       //handle actions
                        if value == "+918141691419" {
                        }
                     })
 }

App Screenshot

Example - 2

 GeometryReader { proxy in 
    MRAttributedTextView(text: "We'will send you an One Time Password on this +918141691419",
                        subStrings: ["One Time Password","+918141691419"],
                        width: proxy, 
                        textFont: .systemFont(ofSize: 16),
                        subsStringFont: .systemFont(ofSize: 16, weight: .bold), 
                        subsStringColor: .black, 
                        alignment: .center, 
                        onTapItemString: { value in
                               //handle actions
                           
                       })
 }

Screenshot

App Screenshot

Example - 3

 GeometryReader { proxy in 
    MRAttributedTextView(text: "By signing up you are agree to our Terms & Condition and Privacy Policy",
                        subStrings: ["Terms & Condition","Privacy Policy"], 
                        width: proxy, 
                        textFont: .systemFont(ofSize: 16), 
                        subsStringFont: .systemFont(ofSize: 16, weight: .bold), 
                        subsStringColor: .systemBlue, alignment: .center, 
                        onTapItemString: { value in
                            if value == "Privacy Policy" {
                                //handle action
                            } else {

                            }
                        })
}

Screenshot

App Screenshot

Example - 4

Note:- If you want padding, use padding horizontal with the same value as padding modifier.

 GeometryReader { proxy in 
    MRAttributedTextView(text: "By signing up you are agree to our Terms & Condition and Privacy Policy",
                        subStrings: ["Terms & Condition","Privacy Policy"], 
                        width: proxy, 
                        textFont: .systemFont(ofSize: 16), 
                        subsStringFont: .systemFont(ofSize: 16, weight: .bold),
                        subsStringColor: .systemBlue, 
                        alignment: .left,
                        paddingHorizontal: 8, // Mandatory
                        onTapItemString: { value in
                             //handle actions
                })
            .padding(8) //Same as paddingHorizontal value
}

Screenshot

App Screenshot

Feedback

If you have any feedback, please reach out to us at [email protected]

GitHub

link
Stars: 7
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.0.1
2 years ago

Initial Release Added by @MaheshRathod4

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics