Skip to content

Commit

Permalink
Merge pull request #28 from hiddevdploeg/force-unwrap-fix
Browse files Browse the repository at this point in the history
Fix for issue #24
  • Loading branch information
hiddevdploeg authored Oct 29, 2023
2 parents c46045e + baabae4 commit 7329159
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ List {

```

You can also hide the dismiss button to have a persistent banner, by adding `hideDismissButtonAndTimer: true` to your `BillboardBannerView`.

![BillboardBannerExamples](https://github.com/hiddevdploeg/Billboard/assets/5016984/259603dd-3160-4552-a3da-990ecb33afd4)

## Configuration
Expand Down Expand Up @@ -201,6 +203,7 @@ Feel free to use the [Billboard template for Figma](https://www.figma.com/commun
- Avoid using your App Icon as the image (as it's already displayed by default).
- Provide an image with no background or has a single color (avoid gradients).
- Photos are allowed as well but will be displayed differently.
- Try and submit an evergreen image that represents your app, show it's good practice to avoid showing UI that gets outdated fast.

## Ad Types
The media of an ad will be displayed covering the whole view when `BillboardAd.fullscreen` is set to `true`. This works great if the media is a photo instead of a visual. Please consider that the photo's subject must be in the center, which will ensure it's always visible.
Expand Down
4 changes: 2 additions & 2 deletions Sources/Billboard/Models/BillboardAd.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public struct BillboardAd : Codable, Identifiable, Equatable {
public let media : URL

/// App Store Link based on `appStoreID`
public var appStoreLink : URL {
return URL(string: "https://apps.apple.com/app/id\(appStoreID)")!
public var appStoreLink : URL? {
return URL(string: "https://apps.apple.com/app/id\(appStoreID)")
}

/// Main Background color in HEX format
Expand Down
4 changes: 3 additions & 1 deletion Sources/Billboard/Views/BillboardBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public struct BillboardBannerView : View {

HStack(spacing: 10) {
Button {
openURL(advert.appStoreLink)
if let url = advert.appStoreLink {
openURL(url)
}
canDismiss = true
} label: {
HStack(spacing: 10) {
Expand Down

0 comments on commit 7329159

Please sign in to comment.