listing all properties of a class in Unreal 5

There is a post that asked how to list properties that can be used for get_editor_property that was for Unreal 4.21:

I tried running this in Unreal 5.4 but of course it errored out due to probably some changes in the API. What would be the correct way to format this for the current version of Unreal?

This is what I have so far:

header:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "MyBlueprintFunctionLibrary.generated.h"

/**
 * 
 */
UCLASS()
class MYPROJECT_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
public:
	UFUNCTION(BlueprintCallable, Category = "Unreal Python")
	static TArray<FString> GetAllProperties(UClass* Class);
};

cpp:

// Fill out your copyright notice in the Description page of Project Settings.


#include "MyBlueprintFunctionLibrary.h"

TArray<FString> UMyBlueprintFunctionLibrary::GetAllProperties(UClass* Class) {
	TArray<FString> Ret;
	if (IsValid(Class)) {
		for (TFieldIterator<FProperty> It(Class); It; ++It) {
			FProperty* Property = *It;
			if (Property->HasAnyPropertyFlags(EPropertyFlags::CPF_Edit)) {
				Ret.Add(Property->GetName());
			}
		}
	}
	return Ret;
}