├── VideoBackgroundSwiftUI
├── VideoBackgroundSwiftUI
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── travel.imageset
│ │ │ ├── travel.png
│ │ │ └── Contents.json
│ │ ├── travel2.imageset
│ │ │ ├── travel2.png
│ │ │ └── Contents.json
│ │ ├── AccentColor.colorset
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Preview Content
│ │ └── Preview Assets.xcassets
│ │ │ └── Contents.json
│ ├── VideoBackgroundSwiftUIApp.swift
│ ├── Model
│ │ └── Card.swift
│ ├── View
│ │ ├── CardView.swift
│ │ ├── PlayerView.swift
│ │ └── TestLogin.swift
│ └── ContentView.swift
└── VideoBackgroundSwiftUI.xcodeproj
│ ├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
│ └── xcuserdata
│ │ └── shreyasvilaschandrabhike.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
│ ├── xcuserdata
│ └── shreyasvilaschandrabhike.xcuserdatad
│ │ └── xcschemes
│ │ └── xcschememanagement.plist
│ └── project.pbxproj
└── README.md
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/travel.imageset/travel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAppWizard/VideoBackgroundSwiftUI/HEAD/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/travel.imageset/travel.png
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/travel2.imageset/travel2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAppWizard/VideoBackgroundSwiftUI/HEAD/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/travel2.imageset/travel2.png
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VideoBackgroundSwiftUI (Updated)
2 | Video Background loop made with SwiftUI
3 | 
4 |
5 | # Video Not Included In Project - Video From [Pixabay](https://pixabay.com/videos/search/boat/)
6 |
7 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/shreyasvilaschandrabhike.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TheAppWizard/VideoBackgroundSwiftUI/HEAD/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI.xcodeproj/project.xcworkspace/xcuserdata/shreyasvilaschandrabhike.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/VideoBackgroundSwiftUIApp.swift:
--------------------------------------------------------------------------------
1 | //
2 | // VideoBackgroundSwiftUIApp.swift
3 | // VideoBackgroundSwiftUI
4 | //
5 | // Created by Shreyas Vilaschandra Bhike on 17/01/22.
6 | //
7 |
8 | import SwiftUI
9 |
10 | @main
11 | struct VideoBackgroundSwiftUIApp: App {
12 | var body: some Scene {
13 | WindowGroup {
14 | ContentView()
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/travel.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "travel.png",
5 | "idiom" : "universal",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "author" : "xcode",
19 | "version" : 1
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/travel2.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "travel2.png",
5 | "idiom" : "universal",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "scale" : "2x"
11 | },
12 | {
13 | "idiom" : "universal",
14 | "scale" : "3x"
15 | }
16 | ],
17 | "info" : {
18 | "author" : "xcode",
19 | "version" : 1
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI.xcodeproj/xcuserdata/shreyasvilaschandrabhike.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | VideoBackgroundSwiftUI.xcscheme_^#shared#^_
8 |
9 | orderHint
10 | 0
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Model/Card.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Card.swift
3 | // VideoBackgroundSwiftUI
4 | //
5 | // Created by Shreyas Vilaschandra Bhike on 17/01/22.
6 | //
7 |
8 | import SwiftUI
9 | import Foundation
10 |
11 |
12 | struct Card: Identifiable {
13 | var id = UUID()
14 | var image : String
15 | var title : String
16 | var description : String
17 |
18 | }
19 |
20 | var testData:[Card] = [
21 |
22 |
23 | Card( image: "",title: "Select Your Destiny", description: "Choose your destination, plan your tour. Select the fabulous place for your holiday"),
24 |
25 | Card(image: "", title: "Schedule Your Trip", description: "Choose the date and get your ticket. We give you the best price"),
26 |
27 | Card( image: "",title: "Enjoy Your Holidays", description: "Enjoy the holiday! Don't forget to take awesome pictures and share with your friends."),
28 |
29 |
30 |
31 | Card( image: "",title: "", description: ""),
32 |
33 |
34 | ]
35 |
36 |
37 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/View/CardView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CardView.swift
3 | // VideoBackgroundSwiftUI
4 | //
5 | // Created by Shreyas Vilaschandra Bhike on 17/01/22.
6 | //
7 |
8 | import SwiftUI
9 |
10 | struct CardView: View {
11 |
12 | var card : Card
13 | var body: some View {
14 | VStack{
15 |
16 | // No Images are Used
17 | Image(card.image)
18 | .resizable()
19 | .frame(width: 400, height: 400)
20 |
21 | Text(card.title)
22 | .font(.system(size: 35))
23 | .fontWeight(.bold)
24 | .foregroundColor(.white)
25 | .offset(x: 0, y: 40)
26 |
27 |
28 | Text(card.description)
29 | .fontWeight(.regular)
30 | .multilineTextAlignment(.center)
31 | .font(.system(size: 22))
32 | .foregroundColor(.white)
33 | .frame(width: 335, height: 100)
34 | .offset(x: 0, y: 40)
35 | .padding(5)
36 |
37 | }.padding()
38 |
39 | }
40 | }
41 |
42 | struct CardView_Previews: PreviewProvider {
43 | static var previews: some View {
44 | CardView(card: testData[1])
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/View/PlayerView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // PlayerView.swift
3 | // VideoBackgroundSwiftUI
4 | //
5 | // Created by Shreyas Vilaschandra Bhike on 17/01/22.
6 | //
7 | import SwiftUI
8 | import AVKit
9 | import AVFoundation
10 |
11 | struct PlayerView: UIViewRepresentable {
12 | func updateUIView(_ uiView: UIView, context: UIViewRepresentableContext) {
13 | }
14 |
15 | func makeUIView(context: Context) -> UIView {
16 | return LoopingPlayerUIView(frame: .zero)
17 | }
18 | }
19 |
20 |
21 | class LoopingPlayerUIView: UIView {
22 | private let playerLayer = AVPlayerLayer()
23 | private var playerLooper: AVPlayerLooper?
24 | required init?(coder: NSCoder) {
25 | fatalError("init(coder:) has not been implemented")
26 | }
27 | override init(frame: CGRect) {
28 | super.init(frame: frame)
29 | // Load the resource -> h
30 | let fileUrl = Bundle.main.url(forResource: "boat", withExtension: "mp4")!
31 | let asset = AVAsset(url: fileUrl)
32 | let item = AVPlayerItem(asset: asset)
33 | // Setup the player
34 | let player = AVQueuePlayer()
35 | playerLayer.player = player
36 | playerLayer.videoGravity = .resizeAspectFill
37 | layer.addSublayer(playerLayer)
38 | // Create a new player looper with the queue player and template item
39 | playerLooper = AVPlayerLooper(player: player, templateItem: item)
40 | // Start the movie
41 | player.play()
42 | }
43 | override func layoutSubviews() {
44 | super.layoutSubviews()
45 | playerLayer.frame = bounds
46 | }
47 | }
48 |
49 | struct PlayerView_Previews: PreviewProvider {
50 | static var previews: some View {
51 | PlayerView()
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "scale" : "1x",
46 | "size" : "20x20"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "scale" : "2x",
51 | "size" : "20x20"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "scale" : "1x",
56 | "size" : "29x29"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "scale" : "2x",
61 | "size" : "29x29"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "scale" : "1x",
66 | "size" : "40x40"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "scale" : "2x",
71 | "size" : "40x40"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "scale" : "1x",
76 | "size" : "76x76"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "scale" : "2x",
81 | "size" : "76x76"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "scale" : "2x",
86 | "size" : "83.5x83.5"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "scale" : "1x",
91 | "size" : "1024x1024"
92 | }
93 | ],
94 | "info" : {
95 | "author" : "xcode",
96 | "version" : 1
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/View/TestLogin.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TestLogin.swift
3 | // VideoBackgroundSwiftUI
4 | //
5 | // Created by Shreyas Vilaschandra Bhike on 17/01/22.
6 | //
7 |
8 | import SwiftUI
9 |
10 | struct TestLogin: View {
11 | var body: some View {
12 | ZStack{
13 | Color.black.opacity(0.5).edgesIgnoringSafeArea(.all)
14 |
15 | LoginBoard()
16 | }
17 | }
18 | }
19 |
20 | struct TestLogin_Previews: PreviewProvider {
21 | static var previews: some View {
22 | TestLogin()
23 | }
24 | }
25 |
26 |
27 | struct LoginBoard: View {
28 |
29 | @State var login = ""
30 | @State var password = ""
31 | var body: some View {
32 | ZStack{
33 | RoundedRectangle(cornerRadius: 35)
34 | .frame(width: 425, height: 320)
35 | .foregroundColor(.white)
36 |
37 | VStack{
38 | HStack{
39 | Text("Hello ,")
40 | .foregroundColor(.gray)
41 | .fontWeight(.bold)
42 | .font(.system(size: 35))
43 |
44 | Spacer().frame(width: 240, height: 0)
45 | }
46 | HStack {
47 | Image(systemName: "person").foregroundColor(.black)
48 | .padding()
49 | Text(login)
50 | .frame(width: 280, height: 50, alignment: .center)
51 | }.overlay(RoundedRectangle(cornerRadius: 8).stroke(Color.gray, lineWidth: 1))
52 |
53 | Spacer().frame(width: 0, height: 10)
54 |
55 | HStack {
56 | Image(systemName: "key").foregroundColor(.black)
57 | .padding()
58 | Text(password)
59 | .frame(width: 280, height: 50, alignment: .center)
60 | }.overlay(RoundedRectangle(cornerRadius: 8).stroke(Color.gray, lineWidth: 1))
61 |
62 |
63 | Spacer().frame(width: 0, height: 60)
64 | }
65 |
66 |
67 | }.offset(x: 0, y: 320)
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/VideoBackgroundSwiftUI/VideoBackgroundSwiftUI/ContentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ContentView.swift
3 | // VideoBackgroundSwiftUI
4 | //
5 | // Created by Shreyas Vilaschandra Bhike on 17/01/22.
6 |
7 | // MARK: Instagram
8 | // TheAppWizard
9 | // theappwizard2408
10 | //
11 |
12 | import SwiftUI
13 |
14 | struct ContentView: View {
15 | var body: some View {
16 | ZStack{
17 | MainView()
18 | }
19 | }
20 | }
21 |
22 | struct ContentView_Previews: PreviewProvider {
23 | static var previews: some View {
24 | ContentView()
25 | }
26 | }
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | struct MainView: View {
48 |
49 | init() {
50 | UIPageControl.appearance().currentPageIndicatorTintColor = .white
51 | UIPageControl.appearance().pageIndicatorTintColor = UIColor.white.withAlphaComponent(0.2)
52 | }
53 |
54 | @State var selectedPage = 0
55 | @State private var showLogin = false
56 | @State private var offsetValue = false
57 |
58 | var body: some View {
59 | ZStack{
60 | PlayerView()
61 | .edgesIgnoringSafeArea(.all)
62 |
63 |
64 | RoundedRectangle(cornerRadius: 20)
65 | .frame(width: 500, height: 320)
66 | .foregroundColor(.black.opacity(0.1))
67 | .blur(radius: 2)
68 | .offset(x: 0, y: 320)
69 |
70 | VStack{
71 | Image("travel2")
72 | .resizable()
73 | .frame(width: 320, height: 160)
74 | .offset(x: 2, y: 25)
75 |
76 | Spacer()
77 | }.padding(20)
78 |
79 |
80 | ZStack{
81 | TabView(selection: $selectedPage)
82 | {
83 | ForEach(0..