Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct ContentView: View {
- @State private var rotation: Double = 0.0
- @State private var toggle1: Bool = false
- @State private var toggle2: Bool = false
- var body: some View {
- TabView {
- NavigationView {
- VStack {
- Spacer()
- Image3D(image: "image", rotation: rotation)
- .frame(width: 200, height: 200)
- .onAppear() {
- withAnimation(Animation.linear(duration: 10).repeatForever(autoreverses: false)) {
- rotation = 360.0
- }
- }
- Spacer()
- }
- .navigationBarTitle("", displayMode: .inline)
- }
- .tabItem {
- Image(systemName: "house")
- }
- NavigationView {
- VStack {
- Spacer()
- Text("Cennik Studyjny")
- .font(.title)
- .padding()
- NeonPricingView(title: "Mix/Master", price: "XXXPLN")
- NeonPricingView(title: "Godzina nagrywek", price: "XXXPLN")
- NeonPricingView(title: "Realizacja", price: "XXXPLN")
- Spacer()
- }
- .navigationBarTitle("", displayMode: .inline)
- }
- .tabItem {
- Image(systemName: "dollarsign.circle")
- }
- NavigationView {
- Text("Treść strony trzeciej")
- .font(.title)
- .navigationBarTitle("", displayMode: .inline)
- }
- .tabItem {
- Image(systemName: "ellipsis")
- }
- NavigationView {
- VStack {
- Text("Ustawienia")
- .font(.title)
- .padding()
- SettingsOptionView(option: "Opcja 1", isOn: $toggle1)
- SettingsOptionView(option: "Opcja 2", isOn: $toggle2)
- Spacer()
- }
- .navigationBarTitle("", displayMode: .inline)
- }
- .tabItem {
- Image(systemName: "gear")
- }
- }
- }
- }
- struct ContentView_Previews: PreviewProvider {
- static var previews: some View {
- ContentView()
- }
- }
- struct Image3D: UIViewRepresentable {
- var image: String
- var rotation: Double
- func makeUIView(context: Context) -> UIView {
- let imageView = UIImageView(image: UIImage(named: image))
- return imageView
- }
- func updateUIView(_ uiView: UIView, context: Context) {
- let angle = CGFloat(rotation * .pi / 180)
- uiView.layer.transform = CATransform3DMakeRotation(angle, 0, 1, 0)
- }
- }
- struct NeonPricingView: View {
- var title: String
- var price: String
- @State private var neonOn = false
- var body: some View {
- HStack {
- Spacer()
- VStack {
- Text(title)
- .font(.headline)
- .foregroundColor(neonOn ? .blue : .white)
- .shadow(color: neonOn ? .blue : .clear, radius: 8)
- .animation(Animation.easeInOut(duration: 1).repeatForever(autoreverses: true))
- Text(price)
- .font(.subheadline)
- }
- Spacer()
- }
- .onAppear {
- neonOn.toggle()
- }
- }
- }
- struct SettingsOptionView: View {
- var option: String
- @Binding var isOn: Bool
- var body: some View {
- HStack {
- Text(option)
- .font(.headline)
- .padding()
- Spacer()
- Toggle("", isOn: $isOn)
- .padding(.horizontal)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement