Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
duweiwang committed Sep 3, 2022
1 parent 72ceddc commit 585e0a4
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ios-playground.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
9476676228B90F5900B56774 /* ZStackDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9476676128B90F5900B56774 /* ZStackDemo.swift */; };
94767EED28B7645900B02512 /* SwiftWithUikitVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94767EEC28B7645900B02512 /* SwiftWithUikitVC.swift */; };
94767EEF28B7683500B02512 /* VStackDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 94767EEE28B7683500B02512 /* VStackDemo.swift */; };
949011B828C33931007104EB /* ListDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 949011B728C33931007104EB /* ListDemo.swift */; };
9490F97028BB11D7007104EB /* GridDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9490F96F28BB11D7007104EB /* GridDemo.swift */; };
9490F97228BB14A4007104EB /* ShapeDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9490F97128BB14A4007104EB /* ShapeDemo.swift */; };
9490F97428BB536D007104EB /* AlignmentDemo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9490F97328BB536D007104EB /* AlignmentDemo.swift */; };
Expand All @@ -41,6 +42,7 @@
9476676128B90F5900B56774 /* ZStackDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZStackDemo.swift; sourceTree = "<group>"; };
94767EEC28B7645900B02512 /* SwiftWithUikitVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftWithUikitVC.swift; sourceTree = "<group>"; };
94767EEE28B7683500B02512 /* VStackDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VStackDemo.swift; sourceTree = "<group>"; };
949011B728C33931007104EB /* ListDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDemo.swift; sourceTree = "<group>"; };
9490F96F28BB11D7007104EB /* GridDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridDemo.swift; sourceTree = "<group>"; };
9490F97128BB14A4007104EB /* ShapeDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShapeDemo.swift; sourceTree = "<group>"; };
9490F97328BB536D007104EB /* AlignmentDemo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlignmentDemo.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -141,6 +143,7 @@
9490F96F28BB11D7007104EB /* GridDemo.swift */,
9490F97128BB14A4007104EB /* ShapeDemo.swift */,
9490F97328BB536D007104EB /* AlignmentDemo.swift */,
949011B728C33931007104EB /* ListDemo.swift */,
);
path = swiftui;
sourceTree = "<group>";
Expand Down Expand Up @@ -231,6 +234,7 @@
9476675A28B908FA00B56774 /* TextDemo.swift in Sources */,
9490F97428BB536D007104EB /* AlignmentDemo.swift in Sources */,
9490F97028BB11D7007104EB /* GridDemo.swift in Sources */,
949011B828C33931007104EB /* ListDemo.swift in Sources */,
94A5E03328B5163100724506 /* ButtonVC.swift in Sources */,
9476675C28B90E2A00B56774 /* ProgressDemo.swift in Sources */,
9476675828B908E400B56774 /* ImageDemo.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion ios-playground/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
DemoItem(name: "Frame", vc: FrameDemo()),
DemoItem(name: "Gride", vc: GridDemo()),
DemoItem(name: "Alignment", vc: AlignmentDemo()),
DemoItem(name: "XX", vc: FrameDemo())
DemoItem(name: "List", vc: ListDemo())
]
]

Expand Down
82 changes: 82 additions & 0 deletions ios-playground/swiftui/ListDemo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// ListDemo.swift
// ios-playground
//
// Created by 王杜伟 on 2022/9/3.
//

import SwiftUI
import UIKit

class ListDemo : SwiftWithUikitVC<ListView> {


override var body: ListView {
ListView()
}

}

struct ListView :View {

let items = [
Item(name: "BeReal", scheme: "bere.al://"),///验证通过
Item(name: "Twitter", scheme: "Twitter://"),///验证通过
Item(name: "Whatsapp", scheme: "whatsapp://"),///验证通过
Item(name: "Messenger", scheme: "fb-messenger://"),///验证通过
Item(name: "Facebook", scheme: "fb://"),///验证通过
Item(name: "Discord", scheme: "discord://"),///验证通过
Item(name: "Instagram", scheme: "instagram://app"),///验证通过
Item(name: "Pinterest", scheme: "pinterest://"),///验证通过
Item(name: "Reddit", scheme: "reddit://"),///验证通过
Item(name: "Snapchat", scheme: "snapchat://"),///验证通过
Item(name: "Tinder", scheme: "tinder://"),///验证通过
Item(name: "Tiktok", scheme: "tiktok://"),///验证通过
Item(name: "Youtube", scheme: "youtube://"),///验证通过
Item(name: "Netflix", scheme: "nflx://"),///验证通过
Item(name: "Amazon", scheme: "com.amazon.mobile.shopping://"),///验证通过
Item(name: "Google", scheme: "googlechrome://"),///验证通过
Item(name: "Gmail", scheme: "googlegmail://"),///验证通过
Item(name: "Google maps", scheme: "GoogleMaps://"),///验证通过
Item(name: "Life360", scheme: "life360://"),///验证通过
Item(name: "Pokemon Go", scheme: "PokemonGo://"),///验证通过
Item(name: "Spotify", scheme: "spotify://"),///验证通过
Item(name: "Roblox", scheme: "roblox://"),///验证通过
Item(name: "Subway Surfers", scheme: "SubwaySurfers://"),///验证通过
Item(name: "Candy Crush", scheme: "CandyCrushSaga://"),///验证通过
]


var body: some View {
ScrollView {
LazyVStack {
ForEach(0..<items.count, id: \.self) { index in
let item = items[index]
Text(item.name)
.padding(.vertical,16)
.overlay(
Divider()
.background(Color.black.opacity(0.04)),
alignment: .bottom
).onTapGesture {
UIApplication.shared.open(URL(string: item.scheme)!) { success in
print ("\(item.name) = \(success)")
}
}
}
}
}

}



}


struct Item {
var name: String
var scheme: String
}


0 comments on commit 585e0a4

Please sign in to comment.