Date   

Re: Correcting scrollbar after app state restoration

Steve Mills
 

On May 14, 2020, at 01:56:27, Allan Odgaard <groups-io@simplit.com> wrote:

You can send reflectScrolledClipView: to the NSScrollView instance after state restoration.

But it should basically never be necessary to call this method manually, so even if it fixes it, something may still be wrong / broken.

https://developer.apple.com/documentation/appkit/nsscrollview/1403534-reflectscrolledclipview
Thanks for pointing out that method. I tried it, but it didn't work. Not sure when the scrollbar is being restored to a stupid value. But, I've added predicate restoration, and that solves it. I also added a small icon that indicates when the collection view is showing some or all items, which lets the user see at a glance after re-open that they might not be seeing everything.

--
Steve Mills
Drummer, Mac geek


Re: Correcting scrollbar after app state restoration

Allan Odgaard <groups-io@...>
 

On 14 May 2020, at 11:00, Steve Mills via groups.io wrote:

I can *not* figure out a good way to tell the collection view, scroll view, or what that it needs to recalc the size of the thumb. It's driving me bonkers. Any ideas?
You can send reflectScrolledClipView: to the NSScrollView instance after state restoration.

But it should basically never be necessary to call this method manually, so even if it fixes it, something may still be wrong / broken.

https://developer.apple.com/documentation/appkit/nsscrollview/1403534-reflectscrolledclipview


Re: Correcting scrollbar after app state restoration

Allan Odgaard <groups-io@...>
 

You can send reflectScrolledClipView: to the NSScrollView instance after state restoration.
 
But it should basically never be necessary to call this method manually, so even if it fixes it, something may still be wrong / broken.
 
https://developer.apple.com/documentation/appkit/nsscrollview/1403534-reflectscrolledclipview


Re: Correcting scrollbar after app state restoration

Steve Mills
 

On May 14, 2020, at 10:13:15, Glenn L. Austin <glenn@austinsoft.com> wrote:

You need to save and restore the state of the data being shown as well. If you use an IndexSet for your sub-collection, you could use, save and restore that.
Hmm. I'd have to restore the search predicate. That should be doable, but it rubs me the wrong way that a document, when restored, only shows the last subset of items instead of showing everything. Photos doesn't restore the find term and show the find results, it shows everything. Neither does Mail. I'd much rather find a way to kick the scrollbar in the ass and tell it to be correct. It's extremely strange that document restoration remembers and restores a scrollbar's thumb size and scroll position. It should be set based on the scrollview's contents.

--
Steve Mills
Drummer, Mac geek


Re: Correcting scrollbar after app state restoration

Glenn L. Austin
 

You need to save and restore the state of the data being shown as well.  If you use an IndexSet for your sub-collection, you could use, save and restore that.

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
<http://www.austinsoft.com>

On May 13, 2020, at 9:00 PM, Steve Mills via groups.io <sjmills@...> wrote:

I've noticed that the vertical scrollbar in the scroll view for my collection view is wrong after app restoration. This happens if the full collection (via CoreData) has, say 1000 items in it, then I do a filtered fetch to limit the collection to, say, 100 items. When showing all 1k items, the scrollbar thumb is small. When showing 100 items, the thumb is much larger.

I save and quit. The next time I launch, it restores the previously opened doc and restores the window state, including the collection view, scroll view, and scrollbar, including restoring the scrollbar state, which means the thumb is large like it was during save and quit, yet the collection view contains all 1k items, not just 100 items.

I can *not* figure out a good way to tell the collection view, scroll view, or what that it needs to recalc the size of the thumb. It's driving me bonkers. Any ideas?

All the restoration crap is just being handled by the OS - I'm not overriding any method to do the state restoration.

--
Steve Mills
Drummer, Mac geek






Correcting scrollbar after app state restoration

Steve Mills
 

I've noticed that the vertical scrollbar in the scroll view for my collection view is wrong after app restoration. This happens if the full collection (via CoreData) has, say 1000 items in it, then I do a filtered fetch to limit the collection to, say, 100 items. When showing all 1k items, the scrollbar thumb is small. When showing 100 items, the thumb is much larger.

I save and quit. The next time I launch, it restores the previously opened doc and restores the window state, including the collection view, scroll view, and scrollbar, including restoring the scrollbar state, which means the thumb is large like it was during save and quit, yet the collection view contains all 1k items, not just 100 items.

I can *not* figure out a good way to tell the collection view, scroll view, or what that it needs to recalc the size of the thumb. It's driving me bonkers. Any ideas?

All the restoration crap is just being handled by the OS - I'm not overriding any method to do the state restoration.

--
Steve Mills
Drummer, Mac geek


Re: CoreData in Objective-C in Xcode 11

Chris Hanson
 

On May 12, 2020, at 5:56 PM, Alex Zavatone via groups.io <zav@...> wrote:

I’m going through Chris Eidhof’s Core Data tutorial here https://www.objc.io/issues/4-core-data/full-core-data-application/ and noticed something that ends up creating a build error directly after creating creating a simple ManagedObjectModel from the Editor > Create NSManagedObject Subclass.

Two Swift files are created, not Objective-C files.

Item+CoreDataProperties.swift
Item+CoreDataClass.swift

The creation of these classes create a build errors right away.  Is it expected that an Objective C project will create Swift MOC subclasses?  Is anyone using CoreData in Xcode 11?
I’m curious what’a happening here.

The language used for creating NSManagedObject (not MOC) subclasses is set in the data model’s file inspector. It defaults to Swift.

Core Data data models also support automatic code generation, which is enabled by default, so if you don’t want classes generated automatically for certain entities you need to specify that in their inspector. You can also specify that just a class extension be generated for a particular entity, so you still own the overall class definition and just the attribute & relationship accessors will be handled for you.

  -- Chris


Re: CoreData in Objective-C in Xcode 11

Alex Zavatone
 

It works as expected in Xcode 10.  : /

On May 12, 2020, at 11:54 PM, Steve Christensen via groups.io <punster@...> wrote:

Check the entity inspector in the model file. As I recall, there are options for auto-creating Obj-C it Swift class files, or manual if you want to create and edit the class files yourself. Perhaps it’s now defaulting to Swift. (I’m not around my computer now, so it’s a guess.)

On May 12, 2020, at 5:56 PM, Alex Zavatone via groups.io <zav@...> wrote:

I’m going through Chris Eidhof’s Core Data tutorial here https://www.objc.io/issues/4-core-data/full-core-data-application/ and noticed something that ends up creating a build error directly after creating creating a simple ManagedObjectModel from the Editor > Create NSManagedObject Subclass.

Two Swift files are created, not Objective-C files.

Item+CoreDataProperties.swift
Item+CoreDataClass.swift

The creation of these classes create a build errors right away.  Is it expected that an Objective C project will create Swift MOC subclasses?  Is anyone using CoreData in Xcode 11?
I’m curious what’a happening here.

Thanks.


<unknown>:0: error: filename "Item+CoreDataClass.swift" used twice: '/Users/zav/Developer/BasicCoreData/BasicCoreData/Item+CoreDataClass.swift' and '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/DerivedSources/CoreDataGenerated/ItemModel/Item+CoreDataClass.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
<unknown>:0: error: filename "Item+CoreDataProperties.swift" used twice: '/Users/zav/Developer/BasicCoreData/BasicCoreData/Item+CoreDataProperties.swift' and '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/DerivedSources/CoreDataGenerated/ItemModel/Item+CoreDataProperties.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name


error: Multiple commands produce '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/Objects-normal/x86_64/Item+CoreDataClass.o':
1) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files
2) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files

error: Multiple commands produce '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/Objects-normal/x86_64/Item+CoreDataProperties.o':
1) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files
2) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files


–––––––––––––––––––––

Item+CoreDataClass.swift


import Foundation
import CoreData

@objc(Item)
public class Item: NSManagedObject {

}


–––––––––––––––––––––

Item+CoreDataProperties.swift


import Foundation
import CoreData


extension Item {

    @nonobjc public class func fetchRequest() -> NSFetchRequest<Item> {
        return NSFetchRequest<Item>(entityName: "Item")
    }

    @NSManaged public var order: Int64
    @NSManaged public var title: String?
    @NSManaged public var parent: Item?
    @NSManaged public var child: Item?

}






Re: CoreData in Objective-C in Xcode 11

Steve Christensen
 

Check the entity inspector in the model file. As I recall, there are options for auto-creating Obj-C it Swift class files, or manual if you want to create and edit the class files yourself. Perhaps it’s now defaulting to Swift. (I’m not around my computer now, so it’s a guess.)

On May 12, 2020, at 5:56 PM, Alex Zavatone via groups.io <zav@...> wrote:

I’m going through Chris Eidhof’s Core Data tutorial here https://www.objc.io/issues/4-core-data/full-core-data-application/ and noticed something that ends up creating a build error directly after creating creating a simple ManagedObjectModel from the Editor > Create NSManagedObject Subclass.

Two Swift files are created, not Objective-C files.

Item+CoreDataProperties.swift
Item+CoreDataClass.swift

The creation of these classes create a build errors right away.  Is it expected that an Objective C project will create Swift MOC subclasses?  Is anyone using CoreData in Xcode 11?
I’m curious what’a happening here.

Thanks.


<unknown>:0: error: filename "Item+CoreDataClass.swift" used twice: '/Users/zav/Developer/BasicCoreData/BasicCoreData/Item+CoreDataClass.swift' and '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/DerivedSources/CoreDataGenerated/ItemModel/Item+CoreDataClass.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
<unknown>:0: error: filename "Item+CoreDataProperties.swift" used twice: '/Users/zav/Developer/BasicCoreData/BasicCoreData/Item+CoreDataProperties.swift' and '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/DerivedSources/CoreDataGenerated/ItemModel/Item+CoreDataProperties.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name


error: Multiple commands produce '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/Objects-normal/x86_64/Item+CoreDataClass.o':
1) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files
2) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files

error: Multiple commands produce '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/Objects-normal/x86_64/Item+CoreDataProperties.o':
1) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files
2) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files


–––––––––––––––––––––

Item+CoreDataClass.swift


import Foundation
import CoreData

@objc(Item)
public class Item: NSManagedObject {

}


–––––––––––––––––––––

Item+CoreDataProperties.swift


import Foundation
import CoreData


extension Item {

    @nonobjc public class func fetchRequest() -> NSFetchRequest<Item> {
        return NSFetchRequest<Item>(entityName: "Item")
    }

    @NSManaged public var order: Int64
    @NSManaged public var title: String?
    @NSManaged public var parent: Item?
    @NSManaged public var child: Item?

}





CoreData in Objective-C in Xcode 11

Alex Zavatone
 

I’m going through Chris Eidhof’s Core Data tutorial here https://www.objc.io/issues/4-core-data/full-core-data-application/ and noticed something that ends up creating a build error directly after creating creating a simple ManagedObjectModel from the Editor > Create NSManagedObject Subclass.

Two Swift files are created, not Objective-C files.

Item+CoreDataProperties.swift
Item+CoreDataClass.swift

The creation of these classes create a build errors right away.  Is it expected that an Objective C project will create Swift MOC subclasses?  Is anyone using CoreData in Xcode 11?
I’m curious what’a happening here.

Thanks.


<unknown>:0: error: filename "Item+CoreDataClass.swift" used twice: '/Users/zav/Developer/BasicCoreData/BasicCoreData/Item+CoreDataClass.swift' and '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/DerivedSources/CoreDataGenerated/ItemModel/Item+CoreDataClass.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name
<unknown>:0: error: filename "Item+CoreDataProperties.swift" used twice: '/Users/zav/Developer/BasicCoreData/BasicCoreData/Item+CoreDataProperties.swift' and '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/DerivedSources/CoreDataGenerated/ItemModel/Item+CoreDataProperties.swift'
<unknown>:0: note: filenames are used to distinguish private declarations with the same name


error: Multiple commands produce '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/Objects-normal/x86_64/Item+CoreDataClass.o':
1) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files
2) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files

error: Multiple commands produce '/Users/zav/Library/Developer/Xcode/DerivedData/BasicCoreData-ddewwduzsmelbzawnlblirktothl/Build/Intermediates.noindex/BasicCoreData.build/Debug-iphonesimulator/BasicCoreData.build/Objects-normal/x86_64/Item+CoreDataProperties.o':
1) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files
2) Target 'BasicCoreData' (project 'BasicCoreData') has compile command for Swift source files


–––––––––––––––––––––

Item+CoreDataClass.swift


import Foundation
import CoreData

@objc(Item)
public class Item: NSManagedObject {

}


–––––––––––––––––––––

Item+CoreDataProperties.swift


import Foundation
import CoreData


extension Item {

    @nonobjc public class func fetchRequest() -> NSFetchRequest<Item> {
        return NSFetchRequest<Item>(entityName: "Item")
    }

    @NSManaged public var order: Int64
    @NSManaged public var title: String?
    @NSManaged public var parent: Item?
    @NSManaged public var child: Item?

}





Re: Action on Pop

Rick Aurbach
 

Ben,

Thanks. You're right. I was getting hung up by thinking that I had to combine the updating of the model and the updating of the UI that displays model elements. But in fact, I can update the model continuously, as long as the UI is always updated in viewWillAppear().

Cheers,

Rick


Re: Action on Pop

Ben Kennedy
 

Hey Rick,

Pass a reference to the data model to the incoming view controller as it’s initialized for pushing onto the stack. The view controller can then make changes to the model as they happen, and doesn’t need to care about its own life cycle.

Deinit is, as you acknowledge, very much the wrong way to do it, in part because its effect relies on assumptions about memory management (which is conceptually unrelated to the business of the view controller).

-ben


On Apr 28, 2020, at 3:58 PM, Rick Aurbach via groups.io <rlaurb@...> wrote:

iOS 13+, Xcode 11.4.1, Storyboard-based application.

I am using a navigation stack to manage some data edits. That is,
  • nav-controller root  is a list of items.
  • tap on item to segue to a detail panel to edit an item (which is a collection of subItems)
  • subItems may either be edited on the detail panel or
  • tap on a subItem to segue to a subDetail panel
        ... etc.

(Typically, this stack is three layers deep, but I'm looking for a solution that works for arbitrary depth.)

Now for all levels of this hierarchy, if the user taps the back button (or performs a gesture with same effect), I need to recognize this fact so that I can pass data up the hierarchy (hopefully without requiring strong coupling throughout).

The way I'm currently doing this is to execute a closure in each panel's deinit method. (Note that viewWillDisappear does not work except in the case of stack-depth == 2)). However putting this kind of code in deinit seems to me to be a code-smell.

Can you suggest an alternate that works at all levels of an arbitrarily deep navigation stack?

Rick Aurbach


Action on Pop

Rick Aurbach
 

iOS 13+, Xcode 11.4.1, Storyboard-based application.

I am using a navigation stack to manage some data edits. That is,
  • nav-controller root  is a list of items.
  • tap on item to segue to a detail panel to edit an item (which is a collection of subItems)
  • subItems may either be edited on the detail panel or
  • tap on a subItem to segue to a subDetail panel
        ... etc.

(Typically, this stack is three layers deep, but I'm looking for a solution that works for arbitrary depth.)

Now for all levels of this hierarchy, if the user taps the back button (or performs a gesture with same effect), I need to recognize this fact so that I can pass data up the hierarchy (hopefully without requiring strong coupling throughout).

The way I'm currently doing this is to execute a closure in each panel's deinit method. (Note that viewWillDisappear does not work except in the case of stack-depth == 2)). However putting this kind of code in deinit seems to me to be a code-smell.

Can you suggest an alternate that works at all levels of an arbitrarily deep navigation stack?

Rick Aurbach


Re: [OT] AppleScript List

Dave
 

I subscribed to this, but I am unable for post to the list. I’m not sure how long they take to activate the account?

On 27 Apr 2020, at 11:47, Bill Cheeseman <wjcheeseman@...> wrote:

And here: https://macscripter.net

Bill Cheeseman

On Apr 26, 2020, at 8:51 AM, Dave <dave@...> wrote:

I see that the old AppleScript list that was hosted by Apple is no more, does anyone know of an alternative?



Re: [OT] AppleScript List

Dave
 

Hi,

I posted to it, but it doesn’t seem to be working, and not received any mail from it since 2016!

Cheers
Dave

On 27 Apr 2020, at 14:12, Shane Stanley <sstanley@myriad-com.com.au> wrote:

On 26 Apr 2020, at 10:51 pm, Dave <dave@looktowindward.com> wrote:

I see that the old AppleScript list that was hosted by Apple is no more
It's still alive today.

--
Shane Stanley <sstanley@myriad-com.com.au>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>




Re: [OT] AppleScript List

Dave
 

Hi,

I registered for it, but haven’t I haven’t had an acknowledgement?  Could you check for me? 


Cheers
Dave


On 26 Apr 2020, at 23:44, Jens Alfke <jens@...> wrote:



On Apr 26, 2020, at 5:51 AM, Dave <dave@...> wrote:

I see that the old AppleScript list that was hosted by Apple is no more, does anyone know of an alternative?

Why, there's an AppleScript list right here: https://apple-dev.groups.io/g/applescript

—Jens


Re: [OT] AppleScript List

Shane Stanley
 

On 26 Apr 2020, at 10:51 pm, Dave <dave@looktowindward.com> wrote:

I see that the old AppleScript list that was hosted by Apple is no more
It's still alive today.

--
Shane Stanley <sstanley@myriad-com.com.au>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>


Re: [OT] AppleScript List

Bill Cheeseman
 

And here: https://macscripter.net

Bill Cheeseman

On Apr 26, 2020, at 8:51 AM, Dave <dave@...> wrote:

I see that the old AppleScript list that was hosted by Apple is no more, does anyone know of an alternative?


Re: [OT] AppleScript List

 



On Apr 26, 2020, at 5:51 AM, Dave <dave@...> wrote:

I see that the old AppleScript list that was hosted by Apple is no more, does anyone know of an alternative?

Why, there's an AppleScript list right here: https://apple-dev.groups.io/g/applescript

—Jens


[OT] AppleScript List

Dave
 

Hi,

I see that the old AppleScript list that was hosted by Apple is no more, does anyone know of an alternative?

Thanks a lot
Dave

181 - 200 of 1426