Mercurial > public > stock-charts
changeset 25:408b68f4ee61
Add DemoProject
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject.xcodeproj/project.pbxproj Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,337 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 95770BDF263C5F85003FA924 /* DemoProjectApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BDE263C5F85003FA924 /* DemoProjectApp.swift */; }; + 95770BE1263C5F85003FA924 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BE0263C5F85003FA924 /* ContentView.swift */; }; + 95770BE3263C5F86003FA924 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95770BE2263C5F86003FA924 /* Assets.xcassets */; }; + 95770BE6263C5F86003FA924 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95770BE5263C5F86003FA924 /* Preview Assets.xcassets */; }; + 95770BEE263C5FCD003FA924 /* Home.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BED263C5FCD003FA924 /* Home.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 95770BDB263C5F85003FA924 /* DemoProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoProject.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 95770BDE263C5F85003FA924 /* DemoProjectApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoProjectApp.swift; sourceTree = "<group>"; }; + 95770BE0263C5F85003FA924 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; + 95770BE2263C5F86003FA924 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + 95770BE5263C5F86003FA924 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; + 95770BE7263C5F86003FA924 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 95770BED263C5FCD003FA924 /* Home.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Home.swift; sourceTree = "<group>"; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 95770BD8263C5F85003FA924 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 95770BD2263C5F85003FA924 = { + isa = PBXGroup; + children = ( + 95770BDD263C5F85003FA924 /* DemoProject */, + 95770BDC263C5F85003FA924 /* Products */, + ); + sourceTree = "<group>"; + }; + 95770BDC263C5F85003FA924 /* Products */ = { + isa = PBXGroup; + children = ( + 95770BDB263C5F85003FA924 /* DemoProject.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 95770BDD263C5F85003FA924 /* DemoProject */ = { + isa = PBXGroup; + children = ( + 95770BDE263C5F85003FA924 /* DemoProjectApp.swift */, + 95770BE0263C5F85003FA924 /* ContentView.swift */, + 95770BED263C5FCD003FA924 /* Home.swift */, + 95770BE2263C5F86003FA924 /* Assets.xcassets */, + 95770BE7263C5F86003FA924 /* Info.plist */, + 95770BE4263C5F86003FA924 /* Preview Content */, + ); + path = DemoProject; + sourceTree = "<group>"; + }; + 95770BE4263C5F86003FA924 /* Preview Content */ = { + isa = PBXGroup; + children = ( + 95770BE5263C5F86003FA924 /* Preview Assets.xcassets */, + ); + path = "Preview Content"; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 95770BDA263C5F85003FA924 /* DemoProject */ = { + isa = PBXNativeTarget; + buildConfigurationList = 95770BEA263C5F86003FA924 /* Build configuration list for PBXNativeTarget "DemoProject" */; + buildPhases = ( + 95770BD7263C5F85003FA924 /* Sources */, + 95770BD8263C5F85003FA924 /* Frameworks */, + 95770BD9263C5F85003FA924 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DemoProject; + productName = DemoProject; + productReference = 95770BDB263C5F85003FA924 /* DemoProject.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 95770BD3263C5F85003FA924 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1250; + LastUpgradeCheck = 1250; + TargetAttributes = { + 95770BDA263C5F85003FA924 = { + CreatedOnToolsVersion = 12.5; + }; + }; + }; + buildConfigurationList = 95770BD6263C5F85003FA924 /* Build configuration list for PBXProject "DemoProject" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 95770BD2263C5F85003FA924; + productRefGroup = 95770BDC263C5F85003FA924 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 95770BDA263C5F85003FA924 /* DemoProject */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 95770BD9263C5F85003FA924 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 95770BE6263C5F86003FA924 /* Preview Assets.xcassets in Resources */, + 95770BE3263C5F86003FA924 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 95770BD7263C5F85003FA924 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 95770BE1263C5F85003FA924 /* ContentView.swift in Sources */, + 95770BEE263C5FCD003FA924 /* Home.swift in Sources */, + 95770BDF263C5F85003FA924 /* DemoProjectApp.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 95770BE8263C5F86003FA924 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 95770BE9263C5F86003FA924 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 14.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 95770BEB263C5F86003FA924 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"DemoProject/Preview Content\""; + DEVELOPMENT_TEAM = MTX83R5H8X; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = DemoProject/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.DemoProject; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 95770BEC263C5F86003FA924 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_ASSET_PATHS = "\"DemoProject/Preview Content\""; + DEVELOPMENT_TEAM = MTX83R5H8X; + ENABLE_PREVIEWS = YES; + INFOPLIST_FILE = DemoProject/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.DemoProject; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 95770BD6263C5F85003FA924 /* Build configuration list for PBXProject "DemoProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 95770BE8263C5F86003FA924 /* Debug */, + 95770BE9263C5F86003FA924 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 95770BEA263C5F86003FA924 /* Build configuration list for PBXNativeTarget "DemoProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 95770BEB263C5F86003FA924 /* Debug */, + 95770BEC263C5F86003FA924 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 95770BD3263C5F85003FA924 /* Project object */; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Workspace + version = "1.0"> + <FileRef + location = "self:"> + </FileRef> +</Workspace>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>IDEDidComputeMac32BitWarning</key> + <true/> +</dict> +</plist>
Binary file DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject.xcodeproj/xcuserdata/dennis.xcuserdatad/xcschemes/xcschememanagement.plist Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>SchemeUserState</key> + <dict> + <key>DemoProject.xcscheme_^#shared#^_</key> + <dict> + <key>orderHint</key> + <integer>0</integer> + </dict> + </dict> +</dict> +</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/Assets.xcassets/AccentColor.colorset/Contents.json Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/Assets.xcassets/AppIcon.appiconset/Contents.json Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/Assets.xcassets/Contents.json Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/ContentView.swift Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,43 @@ +// +// ContentView.swift +// DemoProject +// +// Created by Dennis Concepción Martín on 30/4/21. +// + +import SwiftUI + +struct ContentView: View { + var body: some View { + TabView { + ChartViewPreview(data: generateSampleData(350)) + .tabItem { + Label("ChartView", systemImage: "house") + } + } + } + + private func generateSampleData(_ n: Int) -> [Double] { + var prices = [Double]() + + for _ in (1..<n) { + var lastPrice = prices.last ?? 50.0 + let randomNumber = Double.random(in: 0...0.02) + + if randomNumber < 0.013 { + lastPrice = lastPrice * (1 - randomNumber) + } else { + lastPrice = lastPrice * (1 + randomNumber) + } + + prices.append(lastPrice) + } + return prices + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/DemoProjectApp.swift Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,17 @@ +// +// DemoProjectApp.swift +// DemoProject +// +// Created by Dennis Concepción Martín on 30/4/21. +// + +import SwiftUI + +@main +struct DemoProjectApp: App { + var body: some Scene { + WindowGroup { + ContentView() + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/Home.swift Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,59 @@ +// +// Home.swift +// DemoProject +// +// Created by Dennis Concepción Martín on 30/4/21. +// + +import SwiftUI + +struct Home: View { + var data: [Double] + var dates: [String]? + var hours: [String]? + + var range = ["5D", "1M", "3M", "1Y", "5Y"] + @State private var selectedRange = "3M" + + var body: some View { + NavigationView { + VStack(alignment: .leading) { + Text("Apple Inc") + .font(.title3) + .padding([.horizontal, .bottom]) + + Picker("Select a range", selection: $selectedRange) { + ForEach(range, id: \.self) { + Text($0) + } + } + .pickerStyle(SegmentedPickerStyle()) + .padding(.horizontal) + + ChartView(data: data, dates: dates, hours: hours) + .padding(.vertical) + } + .navigationTitle("AAPL") + .toolbar { + ToolbarItem(placement: .navigationBarTrailing) { + Button(action: {}) { + Image(systemName: "star") + } + } + + ToolbarItem(placement: .navigationBarLeading) { + Button(action: {}) { + Image(systemName: "plus.circle") + } + } + } + } + .navigationViewStyle(StackNavigationViewStyle()) + } +} + +struct Home_Previews: PreviewProvider { + static var previews: some View { + Home() + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/Info.plist Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>$(DEVELOPMENT_LANGUAGE)</string> + <key>CFBundleExecutable</key> + <string>$(EXECUTABLE_NAME)</string> + <key>CFBundleIdentifier</key> + <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>$(PRODUCT_NAME)</string> + <key>CFBundlePackageType</key> + <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>UIApplicationSceneManifest</key> + <dict> + <key>UIApplicationSupportsMultipleScenes</key> + <true/> + </dict> + <key>UIApplicationSupportsIndirectInputEvents</key> + <true/> + <key>UILaunchScreen</key> + <dict/> + <key>UIRequiredDeviceCapabilities</key> + <array> + <string>armv7</string> + </array> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> +</dict> +</plist>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DemoProject/DemoProject/Preview Content/Preview Assets.xcassets/Contents.json Fri Apr 30 17:57:00 2021 +0200 @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +}
--- a/Previews/ChartViewPreview.swift Fri Apr 30 17:48:44 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -// -// ChartViewPreview.swift -// StockCharts -// -// Created by Dennis Concepción Martín on 30/4/21. -// - -import SwiftUI - - -struct ChartViewPreview: View { - var data: [Double] - var dates: [String]? - var hours: [String]? - - var range = ["5D", "1M", "3M", "1Y", "5Y"] - @State private var selectedRange = "3M" - - var body: some View { - NavigationView { - VStack(alignment: .leading) { - Text("Apple Inc") - .font(.title3) - .padding([.horizontal, .bottom]) - - Picker("Select a range", selection: $selectedRange) { - ForEach(range, id: \.self) { - Text($0) - } - } - .pickerStyle(SegmentedPickerStyle()) - .padding(.horizontal) - - ChartView(data: data, dates: dates, hours: hours) - .padding(.vertical) - } - .navigationTitle("AAPL") - .toolbar { - ToolbarItem(placement: .navigationBarTrailing) { - Button(action: {}) { - Image(systemName: "star") - } - } - - ToolbarItem(placement: .navigationBarLeading) { - Button(action: {}) { - Image(systemName: "plus.circle") - } - } - } - } - .navigationViewStyle(StackNavigationViewStyle()) - } -}
--- a/Previews/ContentView.swift Fri Apr 30 17:48:44 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// -// ContentView.swift -// StockCharts -// -// Created by Dennis Concepción Martín on 30/4/21. -// - -import SwiftUI - -struct ContentView: View { - var body: some View { - TabView { - ChartViewPreview(data: generateSampleData(350)) - .tabItem { - Label("ChartView", systemImage: "house") - } - } - } -} - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } -}
--- a/Previews/Sample data/GenerateSampleData.swift Fri Apr 30 17:48:44 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -// -// GenerateSampleData.swift -// StockCharts -// -// Created by Dennis Concepción Martín on 30/4/21. -// - -import SwiftUI - - -/* - Generate sample data - */ -func generateSampleData(_ n: Int) -> [Double] { - var prices = [Double]() - - for _ in (1..<n) { - var lastPrice = prices.last ?? 50.0 - let randomNumber = Double.random(in: 0...0.02) - - if randomNumber < 0.013 { - lastPrice = lastPrice * (1 - randomNumber) - } else { - lastPrice = lastPrice * (1 + randomNumber) - } - - prices.append(lastPrice) - } - return prices -}
--- a/StockCharts.xcodeproj/project.pbxproj Fri Apr 30 17:48:44 2021 +0200 +++ b/StockCharts.xcodeproj/project.pbxproj Fri Apr 30 17:57:00 2021 +0200 @@ -15,9 +15,6 @@ 95770BA5263C594C003FA924 /* IndicatorPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BA4263C594C003FA924 /* IndicatorPoint.swift */; }; 95770BA7263C596E003FA924 /* LinePath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BA6263C596E003FA924 /* LinePath.swift */; }; 95770BA9263C5988003FA924 /* LineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BA8263C5988003FA924 /* LineView.swift */; }; - 95770BAD263C5A13003FA924 /* ChartViewPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BAC263C5A13003FA924 /* ChartViewPreview.swift */; }; - 95770BAF263C5A29003FA924 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BAE263C5A29003FA924 /* ContentView.swift */; }; - 95770BB2263C5A54003FA924 /* GenerateSampleData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BB1263C5A54003FA924 /* GenerateSampleData.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -44,9 +41,6 @@ 95770BA6263C596E003FA924 /* LinePath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinePath.swift; sourceTree = "<group>"; }; 95770BA8263C5988003FA924 /* LineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineView.swift; sourceTree = "<group>"; }; 95770BAA263C59A9003FA924 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; }; - 95770BAC263C5A13003FA924 /* ChartViewPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartViewPreview.swift; sourceTree = "<group>"; }; - 95770BAE263C5A29003FA924 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; - 95770BB1263C5A54003FA924 /* GenerateSampleData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenerateSampleData.swift; sourceTree = "<group>"; }; 95770BB3263C5C2B003FA924 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -77,7 +71,6 @@ 95770BB3263C5C2B003FA924 /* LICENSE.md */, 95770B9B263C57CA003FA924 /* Sources */, 95770B9C263C580C003FA924 /* Tests */, - 95770BAB263C59F5003FA924 /* Previews */, 95770B82263C57B5003FA924 /* Products */, ); sourceTree = "<group>"; @@ -146,24 +139,6 @@ path = Helpers; sourceTree = "<group>"; }; - 95770BAB263C59F5003FA924 /* Previews */ = { - isa = PBXGroup; - children = ( - 95770BAE263C5A29003FA924 /* ContentView.swift */, - 95770BAC263C5A13003FA924 /* ChartViewPreview.swift */, - 95770BB0263C5A34003FA924 /* Sample data */, - ); - path = Previews; - sourceTree = "<group>"; - }; - 95770BB0263C5A34003FA924 /* Sample data */ = { - isa = PBXGroup; - children = ( - 95770BB1263C5A54003FA924 /* GenerateSampleData.swift */, - ); - path = "Sample data"; - sourceTree = "<group>"; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -275,9 +250,6 @@ files = ( 95770BA0263C590C003FA924 /* ChartView.swift in Sources */, 95770BA3263C5934003FA924 /* ChartLabel.swift in Sources */, - 95770BB2263C5A54003FA924 /* GenerateSampleData.swift in Sources */, - 95770BAF263C5A29003FA924 /* ContentView.swift in Sources */, - 95770BAD263C5A13003FA924 /* ChartViewPreview.swift in Sources */, 95770BA7263C596E003FA924 /* LinePath.swift in Sources */, 95770BA9263C5988003FA924 /* LineView.swift in Sources */, 95770BA5263C594C003FA924 /* IndicatorPoint.swift in Sources */,