Post

Replies

Boosts

Views

Activity

Reply to What is a scope ?
Do you understand the problem ? You use HexagonParameters, but is is nowhere defined. How could the compiler guess what it is ? In your code, just add the struct definition: import SwiftUI struct HexagonParameters { struct Segment { let useWidth: (CGFloat, CGFloat, CGFloat) let xFactors: (CGFloat, CGFloat, CGFloat) let useHeight: (CGFloat, CGFloat, CGFloat) let yFactors: (CGFloat, CGFloat, CGFloat) } static let adjustment: CGFloat = 0.085 static let points = [ Segment( useWidth: (1.00, 1.00, 1.00), xFactors: (0.60, 0.40, 0.50), useHeight: (1.00, 1.00, 0.00), yFactors: (0.05, 0.05, 0.00) ), Segment( useWidth: (1.00, 1.00, 0.00), xFactors: (0.05, 0.00, 0.00), useHeight: (1.00, 1.00, 1.00), yFactors: (0.20 + adjustment, 0.30 + adjustment, 0.25 + adjustment) ), Segment( useWidth: (1.00, 1.00, 0.00), xFactors: (0.00, 0.05, 0.00), useHeight: (1.00, 1.00, 1.00), yFactors: (0.70 - adjustment, 0.80 - adjustment, 0.75 - adjustment) ), Segment( useWidth: (1.00, 1.00, 1.00), xFactors: (0.40, 0.60, 0.50), useHeight: (1.00, 1.00, 1.00), yFactors: (0.95, 0.95, 1.00) ), Segment( useWidth: (1.00, 1.00, 1.00), xFactors: (0.95, 1.00, 1.00), useHeight: (1.00, 1.00, 1.00), yFactors: (0.80 - adjustment, 0.70 - adjustment, 0.75 - adjustment) ), Segment( useWidth: (1.00, 1.00, 1.00), xFactors: (1.00, 0.95, 1.00), useHeight: (1.00, 1.00, 1.00), yFactors: (0.30 + adjustment, 0.20 + adjustment, 0.25 + adjustment) ) ] } struct BadgeBackground: View { var body: some View { Path { path in var width: CGFloat = 100.0 let height = width path.move( to: CGPoint( x: width * 0.95, y: height * 0.20 ) ) HexagonParameters.segments.forEach { segment in path.addLine( to: CGPoint( x: width * segment.line.x, y: height * segment.line.y ) ) } } .fill(Color.black) } } struct BadgeBackground_Previews: PreviewProvider { static var previews: some View { BadgeBackground() } }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to 'iPhone unsupported OS version'
Can't you install Xcode 12.5 ? Xcode 12.5 includes SDKs for iOS 14.5, iPadOS 14.5, tvOS 14.5, watchOS 7.4, and macOS Big Sur 11.3. The Xcode 12.5 release supports on-device debugging for iOS 9 and later, tvOS 9 and later, and watchOS 2 and later. Xcode 12.5 requires a Mac running macOS Big Sur 11 or later.
May ’21
Reply to Banner notifications
Logically, the decision to make notification persistent is left as user decision https://stackoverflow.com/questions/47195376/is-there-any-api-so-we-could-handle-ios-persistent-push-notification-via-code-o So, in your app, you could propose user to change its settings, explaining the added comfort he/she will get with persistent notifications. Or, try to get the notifications in your app and let user see them from there, with getDeliveredNotifications getDeliveredNotifications(completionHandler:)     Returns a list of the app’s notifications that are still displayed in Notification Center.  Declaration     func getDeliveredNotifications(completionHandler: @escaping ([UNNotification]) - Void) Parameters     completionHandler     The block to execute with the results. This block may be executed on a background thread. The block has no return value and takes the following parameter:  notifications     An array of UNNotification objects representing the local and remote notifications of your app that have been delivered and are still visible in Notification Center. If none of your app’s notifications are visible in Notification Center, the array is empty. Also have a look here: https://stackoverflow.com/questions/18944883/create-a-persistent-notification-in-ios
Topic: App & System Services SubTopic: Core OS Tags:
May ’21
Reply to UIPickerView button not worked
You cannot add any image in the forum, so bad ! Picker view has 2 buttons "Done" and "Cancel". You mean 2 Text ? Is it SwiftUI ? When user press Done or Cancel, a gray rounded rect popup view(with text "Done" or "Cancel" which user pressed) appeared and disappeared soon like toast message. Could you show the full code so that we can try to reproduce ?
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’21
Reply to bundle identifier
The bundle identifier is created automatically by Xcode. If your question is for declaring a new app in AppStore: Go to Certificates, Identifiers and profiles Select Register an App ID Bundle ID is like com.myCo.myApp : you will find in Xcode TargetsGeneral
May ’21
Reply to Refresh value in text label from JSON
You request the JSON data, so that cannot be done automatically. You have several options: create a timer (frequency 10s ? 60 s ? depends on the data nature) to regularly call for loadData as you did in viewDidLoad and thus update labels you could also tigger by user:              with a refresh button on the view              or when user taps on the table have the server push you notifications and process when receiving. For the first solution, don't forget to kill the timer when you leave the view
May ’21
Reply to MKMapView: How do I set mapType? (beginner question)
There is no conenience init for MKMapView that let you declare the mapType as an init parameter. You should thus write: import MapKit class KMLViewerViewController: UIViewController, MKMapViewDelegate { let map = MKMapView() // etc. ... override func viewDidLoad() { super.viewDidLoad() map.mapType = .hybridFlyover } } Note that map.mapType = .hybridFlyover must be inside a func ; it cannot be at the class level just after etc… Unless you declare it as a computed var: var map : MKMapView { let aMap = MKMapView() aMap.mapType = .hybridFlyover return aMap }
Topic: Programming Languages SubTopic: Swift Tags:
May ’21