Hey there-
I'm having a quite interesting bug on Swift Playgrounds.
I am trying to run my app with this following code snippet which does not compile on Swift Playgrounds, yet compiles on XCode (note: this is a Swift Playground app)
if #available(iOS 18.0, *) {
//simple function to get the indices of other items that have the same date as the "date" variable
            let indices = data!.indices(where: { item in
                let sameMonth = Calendar.current.component(.month, from: item.time) == Calendar.current.component(.month, from: date)
                let sameYear = Calendar.current.component(.year, from: item.time) == Calendar.current.component(.year, from: date)
                let sameDay = Calendar.current.component(.day, from: item.time) == Calendar.current.component(.year, from: date)
                return sameDay && sameMonth && sameYear
            })
However, the indices(where:) codeblock seems to stop the app from compiling (ONLY on Swift Playgrounds - it works perfectly fine on XCode).
I am getting the following error:
Cannot call value of non-function type 'Range<Array<Int>.Index>' (aka 'Range<Int>')
Please let me know if you have any insight regarding this issue.
-ColoredOwl
                    
                  
                
              
                
              
              
                
                Topic:
                  
	
		Programming Languages
  	
                
                
                SubTopic:
                  
                    
	
		Swift
		
  	
                  
                
              
              
                Tags:
              
              
  
  
    
      
      
      
        
          
            Swift Playground
          
        
        
      
      
    
      
      
      
        
          
            Xcode
          
        
        
      
      
    
      
      
      
        
          
            Playground Support
          
        
        
      
      
    
      
      
      
        
          
            SwiftUI