We're developing a new version of the app written entirely in SwiftUI, while the previous version was written in Objective-C. However, my company needs to ensure that the app can run on iOS 12. Is there any way to make SwiftUI compatible with iOS 12?
Post
Replies
Boosts
Views
Activity
Hi, I'm getting the following error while uploading the iOS build from Xcode:
Profile doesn't include the com.apple.CommCenter.fine-grained entitlement. when uploading my app to App Store Connect.
The build is getting succeeded but I'm not able to upload it to app store connect.Any help or suggestions will mean a lot. Thanks!
I want to make it like this
How to disable the button that open the side bar, I only need the content and the detail view. I don't need the sidebar view.
Below is my code
import SwiftUI
@available(iOS 16.0, *)
struct Screen: View {
@ObservedObject var userData = UserData()
@State private var isIntroShown = true
@State var Itema: Bool = false
@State private var showFoodDetail = false
@State var rb: Bool = false
@State var Setting: Bool = false
@State var Recipe: Bool = false
@Environment(\.defaultMinListRowHeight) var minRowHeight
@Environment(\.colorScheme) var colorScheme
@State private var searchText = ""
private let adaptiveColumns = [
GridItem(.adaptive(minimum: 170))
]
var columns = Array(repeating: GridItem(.flexible(), spacing: 10), count: 2)
var filteredRooms: [Room] {
if searchText.isEmpty {
return userData.rooms
} else {
return userData.rooms.filter { room in
let foodNames = room.food.map { $0.name.lowercased() }
return room.name.lowercased().contains(searchText.lowercased()) ||
foodNames.contains { $0.contains(searchText.lowercased()) }
}
}
}
@State private var columnVisibility = NavigationSplitViewVisibility.doubleColumn
var body: some View {
NavigationSplitView (columnVisibility: $columnVisibility){
} content: {
ScrollView{
GridView()
.padding(.horizontal)
.padding(.bottom, 20)
}.toolbar {
ToolbarItem(placement: .bottomBar){
Button(action:{self.Itema = true}) {
HStack {
Image(systemName: "plus.circle.fill").resizable().frame(width: 20, height: 20).foregroundColor(.white)
Text("New Item").foregroundColor(.white).bold()
}
}
.sheet(isPresented: self.$Itema){
NewItem(userData: self.userData)
}
}
ToolbarItem(placement: .bottomBar){
Button(action:{self.rb = true}) {
HStack {
Text("New Room").foregroundColor(.white)
}
}
.sheet(isPresented: self.$rb){
NewRoom(userData: self.userData)
}
}
ToolbarItem(placement: .navigationBarTrailing){
Button(action:{self.Setting = true}) {
HStack {
Image(systemName: "gear").foregroundColor(.white)
}
}
.sheet(isPresented: self.$Setting){
NavigationView {
NewItem( userData: userData)
.navigationBarItems(trailing:Button(action: {
self.Setting = false
}){
Text("Done")
}
)
}
}
}
}
.background(Color(red: 203/255, green: 237/255, blue: 207/255))
} detail: {
ZStack {
Text("")
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(red: 220/255, green: 247/255, blue: 234/255))
}
.searchable(text: $searchText)
}
}
Is the student challenge submission must need to run on the iPad or it can only run on iPhone?
I want to make a picker can choose the room where item put. But the picker is not work.
import SwiftUI
struct NewItem: View{
@Environment(\.dismiss)var dismiss
@ObservedObject var itemStore = ItemStore()
@ObservedObject var roomStore = RoomStore()
@State var Title = ""
@State var Name = ""
@State private var selectedRoom: Room? = RoomStore().rooms.first
@State var Notes = ""
var body: some View{
NavigationView {
List {
Section{
TextField("Title", text: $Title)
TextField("Details", text: $Notes)
}header: {
Text("Detail")
}
Section{
Picker(selection: $selectedRoom, label: Text("Room")) {
ForEach(roomStore.rooms) { room in
Text(room.name).tag(room)
}.onReceive([selectedRoom].publisher.first()) { (room) in
self.selectedRoom = room
}.pickerStyle(MenuPickerStyle())
}
}
}.listStyle(.insetGrouped)
.navigationBarTitle("New Item")
.navigationBarTitleDisplayMode(.inline)
.interactiveDismissDisabled()
.toolbar{
ToolbarItem(placement: .navigationBarTrailing){
Button("Save") {
let newItem = Item(title: self.Title, note: self.Notes, isComplete: false, room: self.selectedRoom?.name ?? "")
self.itemStore.items.append(newItem)
self.dismiss()
}.disabled(Title == "")
}
ToolbarItem(placement: .navigationBarLeading){
Button("Cancel"){
dismiss()
}
}
}
}
}
}
VStack {
Form {
HStack{
GroupBox(label: Image(systemName: "trash.circle.fill").resizable().frame(width: 25, height: 25)) {
VStack(alignment: .leading){
Text("kk")
.bold()
.padding(EdgeInsets(top: 10, leading: 0, bottom: 0, trailing: 15))
.padding(.horizontal, -65)
}
}
.padding(EdgeInsets(top: 0, leading: 0, bottom: 15, trailing: 5))
.frame(width: 160, height: 100)
GroupBox(label: Image(systemName: "trash.circle.fill").resizable().frame(width: 25, height: 25)) {
VStack(alignment: .leading){
Text("kk")
.bold()
.padding(EdgeInsets(top: 10, leading: 0, bottom: 0, trailing: 15))
.padding(.horizontal, -65)
}
}
.padding(EdgeInsets(top: 0, leading: 0, bottom: 15, trailing: 5))
.frame(width: 160, height: 50)
}
HStack{
GroupBox(label: Image(systemName: "trash.circle.fill").resizable().frame(width: 25, height: 25)) {
VStack(alignment: .leading){
Text("kk")
.bold()
.padding(EdgeInsets(top: 10, leading: 0, bottom: 0, trailing: 15))
.padding(.horizontal, -65)
}
}
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 5))
.frame(width: 160, height: 50)
GroupBox(label: Image(systemName: "trash.circle.fill").resizable().frame(width: 25, height: 25)) {
VStack(alignment: .leading){
Text("kk")
.bold()
.padding(EdgeInsets(top: 10, leading: 0, bottom: 0, trailing: 15))
.padding(.horizontal, -65)
}
}
.padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 5))
.frame(width: 160, height: 50)
}.padding(30)
Section{
ForEach(itemStore.items) { item in
NavigationLink(destination: ItemDetailView(item: item)) {
Text(item.title)
}
}.onDelete { indexSet in
self.itemStore.items.remove(atOffsets: indexSet)
}
}
}
}
I want to make a view like the reminder in iphone like this