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 var xpos: CGFloat = 400 | |
| @State var ypos: CGFloat = 200 | |
| var body: some View { | |
| ZStack { | |
| Circle() | |
| .frame(width: 50, height: 50) | |
| .foregroundColor(.blue) | |
| .position(x: xpos, y: ypos) |
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 var xpos: CGFloat = 400 | |
| @State var ypos: CGFloat = 200 | |
| var body: some View { | |
| ZStack { | |
| Circle() | |
| .frame(width: 50, height: 50) | |
| .foregroundColor(.blue) | |
| .position(x: xpos, y: ypos) |
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 var xpos: CGFloat = 400 | |
| @State var ypos: CGFloat = 200 | |
| var body: some View { | |
| ZStack { | |
| Circle() | |
| .frame(width: 50, height: 50) |
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
| # Dump | |
| if args.output_mode == 'json': | |
| # Write JSON | |
| with open(args.fname_out,'w') as f: | |
| rjson = [ r.to_json() for r in ritems ] | |
| json.dump(rjson,f,indent=3) | |
| print("Wrote reading list to JSON file: %s" % args.fname_out) | |
| elif args.output_mode == 'csv': |
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
| @dataclass | |
| class ReadingListItem(json.JSONEncoder): | |
| title: str | |
| ServerID: str | |
| neverFetchMetadata: bool | |
| WebBookmarkType: str | |
| WebBookmarkUUID: str | |
| URLString: str | |
| DateAdded: datetime.datetime |
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
| def find_dicts_with_rlist_keys_in_dict(base_dict): | |
| ret = [] | |
| for key,val in base_dict.items(): | |
| if key == "Children": | |
| # Recurse down | |
| for child_dict in val: | |
| ret += find_dicts_with_rlist_keys_in_dict(child_dict) | |
| elif key == "ReadingList": | |
| ret.append(base_dict) |
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
| # Copy the plist file for safety | |
| fname_plist = "tmp.plist" | |
| command = "cp %s %s" % (args.fname_bookmarks, fname_plist) | |
| print("Making temporary copy of reading list: %s" % command) | |
| Popen(command, shell=True).wait() |
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
| // Lazy navigation link | |
| NavigationLink { | |
| NavigationLazyLoadView( | |
| DetailView(idx: idx) | |
| ) | |
| } label: { | |
| Text("Go to \(idx)") | |
| } |
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
| // The detail view | |
| struct DetailView: View { | |
| var idx: Int | |
| init(idx: Int) { | |
| self.idx = idx | |
| print("Page: \(idx) constructed") | |
| } | |
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
| // The list view | |
| struct ListView: View { | |
| var body: some View { | |
| NavigationView { | |
| List { | |
| ForEach(1...10, id: \.self) { idx in | |
| // Navigation link | |
| NavigationLink { |