If you have a paid Apple Developer account, macOS Big Sur beta profile is available here - https://developer.apple.com/download/.
Post
Replies
Boosts
Views
Activity
Have you tried running it on a real device rather than Simulator or SwiftUI Preview?
I had a similar problem, not with trim, but with opacity Any opacity value less than 1.0 hides the view in Simulator and SwiftUI Preview. But it worked fine on real device.
Still not fixed in Xcode 12.5 beta 2 (12E5234g)
I have filed feedback regarding this. FB8986928
@JoeKun,
I should have provided these details when asking the question. Sorry about that.
I am using iOS 15 beta 3. Here's the code I am using to fetch library playlists:
var playlists: [Playlist]
struct MyPlaylistsResponse: Decodable {
let data: [Playlist]
}
let url = URL(string: "https://api.music.apple.com/v1/me/library/playlists")!
let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: url))
do {
let dataResponse = try await dataRequest.response()
let decoder = JSONDecoder()
let playlistsResponse = try decoder.decode(MyPlaylistsResponse.self, from: dataResponse.data)
playlists = playlistsResponse.data
} catch let error {
print("** Error **")
print(error)
}
and then I am trying to get the curator name like this:
for playlist in playlists {
print(playlist.curatorName)
}
playlist.curatorName returns nil for all playlists in array.
Although @snuff4's answer solved the empty cells issue in my real project, scrolling to desired cell/row wasn't working when using ScrollViewReader's scrollTo method.
I have come up with a weird fix that works for me. It is weird because I don't know how and why it works, but it works. If anyone can explain why it works, I'll be very thankful.
The solution is, I created a new ViewModifier named EmbedInSection that just embeds the content in Section.
struct EmbedInSection: ViewModifier {
func body(content: Content) -> some View {
Section {
content
}
}
}
And I used it like:
var body: some View {
List {
ForEach(intervals) { interval in
Text(interval.name)
.id(interval.id)
.modifier(EmbedInSection())
}
}
}
I am also facing this same issue