Any reources available to learn advanced animation from scratch it would be helpful if someone mentions any resiurces thank you
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have created the .json file according to the https://developer.apple.com/documentation/createml/building-an-object-detector-data-source
here is my .json file below
{
"imagefilename":"Five Fingers.HEIC",
"annotation": [
{
"coordinates": {
"y": 156.062,
"x": 195.122,
"height": 148.872,
"width": 148.03
},
"label": "Five Fingers"
}
]
},
{
"imagefilename": "One Finger.HEIC",
"annotation": [
{
"coordinates": {
"y": 156.062,
"x": 195.122,
"height": 148.872,
"width": 148.03
},
"label": "One Finger"
}
]
},
{
"imagefilename": "Two Finger.HEIC",
"annotation": [
{
"coordinates": {
"y": 156.062,
"x": 195.122,
"height": 148.872,
"width": 148.03
},
"label": "Two Finger"
}
]
},
{
"imagefilename": "Four Finger.HEIC",
"annotation": [
{
"coordinates": {
"y": 156.062,
"x": 195.122,
"height": 148.872,
"width": 148.03
},
"label": "Four Finger"
}
]
}
]
but it shows error as Missing required column 'label' in json. at "NameOfJsonFile.json"
Were am I Wrong
As I’m interested to make HomeKit accessory while searching in the internet i found out that hobbyist can make HomeKit accessary without MFI license the link is given below
https://mfi.apple.com/en/who-should-join.html
but it says to download HAP Specification which is pdf containing all the information regarding interacting with Apple devices with HomeKit Accessories
but im not able to see any pdf in the give link
can anyone say where will be the pdf is present to download
Thank you in advance
I have requested the access from the HealthKit by below code
let calorieCount = HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.activeEnergyBurned)!
and it working perfectly but not able to read the data using Query
after reading the documentation I have found out HKStatisticsQuery is used for Query
func CaloriesBurned() {
let activeEnergy = HKQuantityType.quantityType(forIdentifier: .activeEnergyBurned)!
let startDate = Calendar.current.date(byAdding: .day,value: -7, to: Date())
let predicate = HKQuery.predicateForSamples(withStart: startDate, end: Date(), options: .strictStartDate)
let query = HKStatisticsQuery(quantityType: activeEnergy, quantitySamplePredicate: predicate,completionHandler: <#T##(HKStatisticsQuery, HKStatistics?, Error?) -> Void#>))
}
but I don't understand what should be written in completion handler in above code to read the active Energy Burned
I have read already documentation if anyone has sample code to read energy burned or sample code on how to use HKStatisticsQuery
I wanted to make a Gauge View to display the angle Moved below is the image
and the needle give the angle according to the input is given ,but I need to change the direction of the needle with some animation as of now its just moving like a glitch
below is my code
import SwiftUI
struct RudderView: View {
@State var ArrowValue: CGFloat = -100
let AngleTimer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect()
var body: some View {
NavigationView {
ZStack{
Circle()
.stroke(.gray.opacity(0.1),lineWidth: 25)
Circle()
.trim(from: 0,to: 0.75)
.stroke(Gradient(colors: [.red,.white,.green]), style: StrokeStyle(lineWidth: 25,lineCap: .round,lineJoin: .round))
.rotationEffect(Angle(degrees: -225))
ZStack {
RoundedRectangle(cornerRadius: 20)
.foregroundColor(.white)
.frame(width: 25, height: 150)
}
.offset(x:0, y: -50)
.rotationEffect(Angle(degrees: ArrowValue))
.onReceive(AngleTimer) { _ in
withAnimation {
}
}
}
Text("40")
.font(.largeTitle)
.fontWeight(.thin)
.foregroundColor(.white)
.offset(x:100, y:170)
Text("-40")
.font(.largeTitle)
.fontWeight(.thin)
.foregroundColor(.white)
.offset(x:-100, y:170)
}
.padding()
}
}
}
struct RudderView_Previews: PreviewProvider {
static var previews: some View {
RudderView()
.preferredColorScheme(.dark)
}]w
}
can anyone say what to type in the animation bracket to move my needle smoothly according to the changes of input for arrow
I have created Swift Charts using Ready Made Data Like below
static let last12Months = [
(month: date(year: 2022, month: 6), KW: 3952, dailyAverage: 127, dailyMin: 95, dailyMax: 345),
(month: date(year: 2022, month: 7), KW: 8322, dailyAverage: 124, dailyMin: 55, dailyMax: 255),
(month: date(year: 2022, month: 8), KW: 2952, dailyAverage: 245, dailyMin: 99, dailyMax: 673),
(month: date(year: 2022, month: 9), KW: 3352, dailyAverage: 875, dailyMin: 92, dailyMax: 623),
(month: date(year: 2022, month: 10), KW: 3252, dailyAverage: 257,dailyMin: 55, dailyMax: 675),
(month: date(year: 2022, month: 11), KW: 3232, dailyAverage: 537,dailyMin: 65, dailyMax: 643),
(month: date(year: 2022, month: 12), KW: 9871, dailyAverage: 253,dailyMin: 25, dailyMax: 987),
(month: date(year: 2023, month: 1), KW: 8623, dailyAverage: 235, dailyMin: 96, dailyMax: 353),
(month: date(year: 2023, month: 2), KW: 7612, dailyAverage: 276, dailyMin: 64, dailyMax: 765),
(month: date(year: 2023, month: 3), KW: 2335, dailyAverage: 978, dailyMin: 36, dailyMax: 456),
(month: date(year: 2023, month: 4), KW: 9087, dailyAverage: 667, dailyMin: 63, dailyMax: 675),
(month: date(year: 2023, month: 5), KW: 2823, dailyAverage: 865, dailyMin: 100, dailyMax: 765),
(month: date(year: 2023, month: 6), KW: 9762, dailyAverage: 544, dailyMin: 36, dailyMax: 999),
]
`but now I want to create same charts with real world reading like Health App.
For example aim taking the sensor value through bluetooth, I can show the reading from sensor to app but how can I store the data for months and show them in Charts
Any Ideas where am I lagging`
I need to send confirmation mail to customer once, When Customer orders it.
I have some methods in Google but all of those methods Triggers the Mail Extension in Mail App and Opens up Mail
I don't need to trigger and show the Mail to Customers
I just want to send the Order summary to customer Mail Address
is there any way or API , SDK
when I'm using for each loop(using repeat command) instead of printing 5 items it is printing 10 times, it always doubles my command
it is my code
NavigationView {
ScrollView {
ScrollView(.horizontal , showsIndicators: false){
HStack(spacing: -10){
ForEach(0..<5) { item in
NavigationLink(destination: DetailView()) {
CardView()
CardView()
import SwiftUI
struct List_View: View {
var Wallet : Wallet_Data
var body: some View {
ZStack {
ListRectShape()
.fill(Color.background)
.frame(width: 368, height: 75)
Wallet.image
.padding(.trailing, 280.0)
Text("Amazon")
.font(.title3)
.fontWeight(.light)
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.padding(.top, -25.0)
.padding(.trailing, 125.0)
Text("Augest 10 2022")
.font(.body)
.fontWeight(.light)
.foregroundColor(Color.white)
.padding(.trailing, 78.0)
.padding(.top, 21.0)
ListRectShape()
.fill(Color.background)
.frame(width: 83, height: 33)
.border(Color.white)
.padding(.leading, 225.0)
Text("$109.08")
.foregroundColor(Color.white)
.padding(.leading, 225.0)
}
ZStack {
ListRectShape()
.fill(Color.background)
.frame(width: 368, height: 75)
Image("Apple WC")
.padding(.trailing, 280.0)
Text("Apple")
.font(.title3)
.fontWeight(.light)
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.padding(.top, -22.0)
.padding(.trailing, 145.0)
Text("Augest 10 2022")
.font(.body)
.fontWeight(.light)
.foregroundColor(Color.white)
.padding(.trailing, 78.0)
.padding(.top, 21.0)
ListRectShape()
.fill(Color.background)
.frame(width: 83, height: 33)
.border(Color.white)
.padding(.leading, 225.0)
Text("$1000.00")
.foregroundColor(Color.white)
.padding(.leading, 225.0)
}
}
}
struct List_View_Previews: PreviewProvider {
static var previews: some View {
List_View(Wallet: Wallet_App[0]) // here is were I'm getting an error
}
}
//this is my ModelData were I'm trying to load my json file
import Foundation
import Combine
final class ModelData : ObservableObject{
var Wallet_App: [Wallet_Data] = load("Contents.json")
}
func load<T: Decodable>(_ filename: String) -> T {
let data: Data
guard let file = Bundle.main.url(forResource: filename, withExtension: nil)
else {
fatalError("Couldn't find (filename) in main bundle.")
}
do {
data = try Data(contentsOf: file)
} catch {
fatalError("Couldn't load (filename) from main bundle:\n(error)")
}
do {
let decoder = JSONDecoder()
return try decoder.decode(T.self, from: data)
} catch {
fatalError("Couldn't parse (filename) as (T.self):\n(error)")
}
}
like the below Figma file
Button(action:
CardView() //here it show an error how to add the CardView Swift ui file in this button //
) {
Image(systemName: "creditcard")
.resizable()
.foregroundColor(Color("Icon Color"))
.frame(width:24, height: 24)
}
.padding(.top, 825.0)
.padding(.trailing, 125.0)
I'm trying to add a video in viewController and there is a minor issue. I'm not able view video them in simulator can any one explain how to view viewController in simulator.
when I click the play button it only displays the ContentView
import Foundation
enum VideoDetails: String, CaseIterable{
case Nature , Food , Animals , Travel
}
struct ResponseBody: Decodable {
var page: Int
var perPage: Int
var totalResults: Int
var url: String
var videos: [Video]
}
struct Video: Identifiable, Decodable{
var id: Int
var image: String
var duration: Int
var user: User
var videofiles: [VideoFile]
struct User: Identifiable, Decodable {
var id: Int
var name: String
var url: String
}
struct VideoFile: Identifiable, Decodable {
var id: Int
var quality: String
var fileType: String
var link: String
}
}
//this one doesn't work but the below code works perfectly can anyone why it is happening
import Foundation
enum VideoDetails: String, CaseIterable{
case Nature , Food , Animals , Travel
}
struct Video: Identifiable, Decodable {
var id: Int
var image: String
var duration: Int
var user: User
var videoFiles: [VideoFile]
struct User: Identifiable, Decodable {
var id: Int
var name: String
var url: String
}
struct VideoFile: Identifiable, Decodable {
var id: Int
var quality: String
var fileType: String
var link: String
}
}
import SwiftUI
struct ButtonUI: View {
var body: some View {
ZStack {
Color.white
RoundedRectangle(cornerRadius: 50)
.fill(.blue)
.frame(width: 250, height: 75, alignment: .center)
Text("Enable Location")
.font(.title3)
.fontWeight(.bold)
.foregroundColor(Color.white)
}
.offset(x: 0, y: 300)
}
}
struct ButtonUI_Previews: PreviewProvider {
static var previews: some View {
ButtonUI()
}
}
// I have used this code to create a button like shape in Xcode how to do i make it work like open the location settings in iPhone
// it should work like a button to open the location settings in iPhone
I have just started to learn Storyboard While I was Creating the View Controller,
the Assistant doesn't open up to opens up only for navigation controller.
I have like 2 View Controller, Assistant doesn't showing up for those two of them.
can anyone point out where it I make a mistake.