diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1509e65 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,6 @@ +## Legal + +By submitting a pull request, you represent that you have the right to license +your contribution to ZeeZide and the community, and agree by submitting the patch +that your contributions are licensed under the MIT license. + diff --git a/LICENSE b/LICENSE index 5958a20..0dee8f9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017-2018 ZeeZide GmbH +Copyright (c) 2017-2021 ZeeZide GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Sources/UXKit/AppKit/UXFont-AppKit.swift b/Sources/UXKit/AppKit/UXFont-AppKit.swift index 7be5776..97c0e06 100644 --- a/Sources/UXKit/AppKit/UXFont-AppKit.swift +++ b/Sources/UXKit/AppKit/UXFont-AppKit.swift @@ -1,10 +1,11 @@ // // UXKit // -// Copyright © 2016-2017 ZeeZide GmbH. All rights reserved. +// Copyright © 2016-2021 ZeeZide GmbH. All rights reserved. // #if os(macOS) import Cocoa - public typealias UXFont = NSFont + public typealias UXFont = NSFont + public typealias NSUnderlineStyle = AppKit.NSUnderlineStyle #endif diff --git a/Sources/UXKit/Common/UXTextView.swift b/Sources/UXKit/Common/UXTextView.swift index 3b99bd3..56ae0b0 100644 --- a/Sources/UXKit/Common/UXTextView.swift +++ b/Sources/UXKit/Common/UXTextView.swift @@ -3,23 +3,45 @@ // UXKit // // Created by Helge Heß on 16.05.20. -// Copyright © 2020 ZeeZide GmbH. All rights reserved. +// Copyright © 2020-2021 ZeeZide GmbH. All rights reserved. // #if !os(macOS) - import class UIKit.NSTextStorage - import class UIKit.NSLayoutManager - import class UIKit.NSTextContainer + import class UIKit.NSTextStorage + import class UIKit.NSLayoutManager + import class UIKit.NSTextContainer + import struct UIKit.NSTextStorageEditActions + import class UIKit.UITextView public typealias NSTextStorage = UIKit.NSTextStorage public typealias NSLayoutManager = UIKit.NSLayoutManager public typealias NSTextContainer = UIKit.NSTextContainer + + public typealias NSTextStorageEditActions = UIKit.NSTextStorage.EditActions + + public extension UITextView { + + @inlinable + var string : String { // NeXTstep was right! + set { text = newValue} + get { return text } + } + } #else // macOS - import class AppKit.NSTextStorage - import class AppKit.NSLayoutManager - import class AppKit.NSTextContainer + import class AppKit.NSTextStorage + import class AppKit.NSLayoutManager + import class AppKit.NSTextContainer + import struct AppKit.NSTextStorageEditActions public typealias NSTextStorage = AppKit.NSTextStorage public typealias NSLayoutManager = AppKit.NSLayoutManager public typealias NSTextContainer = AppKit.NSTextContainer + + @available(macOS 10.11, *) + public typealias NSTextStorageEditActions = AppKit.NSTextStorageEditActions + + @available(macOS 10.11, *) + public extension NSTextStorage { + typealias EditActions = NSTextStorageEditActions + } #endif // macOS diff --git a/Sources/UXKit/UIKit/UXFont-UIKit.swift b/Sources/UXKit/UIKit/UXFont-UIKit.swift index 15a6a44..ae0744e 100644 --- a/Sources/UXKit/UIKit/UXFont-UIKit.swift +++ b/Sources/UXKit/UIKit/UXFont-UIKit.swift @@ -1,10 +1,28 @@ // // UXKit // -// Copyright © 2016-2017 ZeeZide GmbH. All rights reserved. +// Copyright © 2016-2021 ZeeZide GmbH. All rights reserved. // #if !os(macOS) import UIKit - public typealias UXFont = UIFont -#endif + public typealias UXFont = UIFont + public typealias NSUnderlineStyle = UIKit.NSUnderlineStyle + + public extension UXFont { + + /** + * macOS compat. Only works on iOS 13+ (otherwise returns nil). + * + * Calls into `UIFont.monospacedSystemFont()`. + */ + static func userFixedPitchFont(ofSize size: CGFloat) -> UXFont? { + if #available(iOS 13.0, *) { + return UIFont.monospacedSystemFont(ofSize: size, weight: .regular) + } + else { + return nil + } + } + } +#endif // !os(macOS) diff --git a/UXKit.xcodeproj/project.pbxproj b/UXKit.xcodeproj/project.pbxproj index e203815..59933fd 100644 --- a/UXKit.xcodeproj/project.pbxproj +++ b/UXKit.xcodeproj/project.pbxproj @@ -301,7 +301,7 @@ E8A9B22E1FBB318700C1063B /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1310; ORGANIZATIONNAME = "ZeeZide GmbH"; TargetAttributes = { E85CBD30233F736A0065D1DB = { diff --git a/UXKit.xcodeproj/xcshareddata/xcschemes/UXKit-AllPlatforms.xcscheme b/UXKit.xcodeproj/xcshareddata/xcschemes/UXKit-AllPlatforms.xcscheme index 81cbdf1..9b77fc1 100644 --- a/UXKit.xcodeproj/xcshareddata/xcschemes/UXKit-AllPlatforms.xcscheme +++ b/UXKit.xcodeproj/xcshareddata/xcschemes/UXKit-AllPlatforms.xcscheme @@ -1,6 +1,6 @@