https://github.com/jeon0976/speechbubble
SpeechBubble-iOS-Swift
https://github.com/jeon0976/speechbubble
ios label speech-bubble speechbubble swift uikit uilabel uiview view
Last synced: 10 months ago
JSON representation
SpeechBubble-iOS-Swift
- Host: GitHub
- URL: https://github.com/jeon0976/speechbubble
- Owner: Jeon0976
- License: mit
- Created: 2024-04-29T12:01:17.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-01T04:03:02.000Z (over 1 year ago)
- Last Synced: 2024-05-02T07:43:45.013Z (over 1 year ago)
- Topics: ios, label, speech-bubble, speechbubble, swift, uikit, uilabel, uiview, view
- Language: Swift
- Homepage:
- Size: 6.79 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SpeechBubble
[](https://travis-ci.org/Jeon0976/SpeechBubble)
[](https://cocoapods.org/pods/SpeechBubble)
[](https://cocoapods.org/pods/SpeechBubble)
[](https://cocoapods.org/pods/SpeechBubble)
## SpeechBubble
SpeechBubble is an iOS View class that incorporates both an arrow and a label view.
It is designed to dynamically adapt its presentation in response to changes in parameters, ensuring a seamless user experience.

## Requirements
SpeechBubble requires iOS 13.0 or later.
It depends on the following Apple frameworks:
- Foundaiton
- UIKit
Swift Versions:
- Swift 5
## Installation
SpeechBubble is available through [CocoaPods](https://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'SpeechBubble'
```
To get the full benefits import `SpeechBubble` wherever you import UIKit
``` swift
import UIKit
import SpeechBubble
```
Swift Package Manager
SpeechBubble is available through Swift Package Manager.
## Example
``` swift
private let speechBubbleView1 = SpeechBubbleView(text: "test", style: .fill, arrowPosition: .top)
private let speechBubbleView2 = SpeechBubbleView(text: "test", style: .line, arrowPosition: .top, arrowPositionRatio: 0.3)
private let speechBubbleView3 = SpeechBubbleView(text: "test", style: [.fill, .dottedLine], arrowPosition: .top, arrowPositionRatio: 0.3)
private lazy var speechBubbleView4: SpeechBubbleView = {
let view = SpeechBubbleView(text: "test", style: [.fill], arrowPosition: .top)
view.textColor = .black
view.filledColor = .systemYellow
return view
}()
```
### SpeechBubble parameters
- **text**: String **(Required)**
- **font**: UIFont - default: .systemFont(ofSize: 16, weight: .medium)
- **numberOfLines**: Int - default: 0
- **textAlignment**: NSTextAlignment - default: .center
- **textColor**: UIColor - default: .label
- **textInset**: CGFloat - default: 16
- **filledColor**: UIColor - default: .systemGroupedBackground
- **borderColor**: UIColor - default: .separator
- **borderWidth**: CGFloat - default: 2
- **style**: SpeechBubbleStyleOptions **(Required)**
- Options: fill, line, dottedLine
- Multiple options can be combined, with dottedLine taking precedence over line.
- **clipsToBounds**: Bool - default: true
- **cornerRadious**: CGFloat - default: 15
- **arrowSize**: CGFloat - default: 10
- **arrowPosition**: SpeechBubbleArrowPosition **(Required)**
- Options: top, bottom, left, right
- Only one can be selected.
- **arrowPositionRatio**: CGFloat - default: 0.5
## Author
Jeon0976, jsh097610@gmail.com
## License
SpeechBubble is available under the MIT license. See the LICENSE file for more info.