gpt4 book ai didi

ios - swift : How can I get time in hours of my current location for my app?

转载 作者:行者123 更新时间:2023-11-30 11:45:38 25 4
gpt4 key购买 nike

我目前正在学习如何在 iOS 应用程序中实现 API。目前我正在编写一个应用程序,其中该应用程序显示当前温度。在后台,我想使用时间播放 GIF,即,如果时间 > 下午 5 点,它将显示夜间 gif,如果时间 < 下午 5 点,它将显示阳光明媚的 gif。我的应用程序获取用户的当前位置,但我不知道如何获取特定位置的时间。请同样帮助我:)

最佳答案

使用这个:

let date = Date()
let calendar = Calendar.current
let hour = calendar.component(.hour, from: date)
let minutes = calendar.component(.minute, from: date)

关于ios - swift : How can I get time in hours of my current location for my app?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48852146/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com