This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ExpandableText: View { | |
@State private var expanded: Bool = false | |
@State private var truncated: Bool = false | |
private var text: String | |
let lineLimit: Int | |
init(_ text: String, lineLimit: Int) { | |
self.text = text | |
self.lineLimit = lineLimit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct Banner: View { | |
struct BannerDataModel { | |
var title:String | |
var detail:String | |
var type: BannerType | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Toast: View { | |
struct ToastDataModel { | |
var title:String | |
var image:String | |
} | |
let dataModel: ToastDataModel | |
@Binding var show: Bool | |
var body: some View { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct OverlayDemo: View { | |
@State private var showOverlay = false | |
var body: some View { | |
Text("Hello, World!").overlay(overlayView: Text("OverlyText").background(Color.red).onTapGesture { | |
withAnimation { | |
showOverlay.toggle() | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@State private var badgeNumber: Int = 10 | |
private var badgePosition: Int = 1 | |
private var tabsCount: CGFloat = 2 | |
@State private var selectedTab = 0 | |
@State private var name = "" | |
var body: some View { | |
GeometryReader { geometry in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
final class BadgeUpdater { | |
var badgeNumber: Int { ///update on change of badge value | |
didSet { | |
self.tabViewController?.viewControllers?[badgeIndex].tabBarItem.badgeValue = "\(self.badgeNumber)" | |
} | |
} | |
var badgeIndex: Int { ///update on change of index | |
didSet { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@State private var percent = 50.0 | |
@State private var waveOffset = Angle(degrees: 0) | |
@State private var waveOffset2 = Angle(degrees: 180) | |
@State var timerTest : Timer? | |
var body: some View { | |
VStack { | |
ZStack(alignment: .center) { | |
Rectangle().frame(width: 200, height: 220) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Wave: Shape { | |
var offset: Angle | |
var percent: Double | |
var animatableData: Double { | |
get { offset.degrees } | |
set { offset = Angle(degrees: newValue) } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
@State private var percent = 50.0 | |
@State private var waveOffset = Angle(degrees: 0) | |
@State private var waveOffset2 = Angle(degrees: 180) | |
@State var timerTest : Timer? | |
var body: some View { | |
VStack { |